docker-compose.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. version: '3.8'
  2. services:
  3. happy-cloud-mysql:
  4. build:
  5. context: /mnt/product/cloud/db
  6. env_file:
  7. - /mnt/product/cloud/db/env/mysql.env #指定配置文件启动
  8. restart: always
  9. container_name: happy-cloud-mysql
  10. image: happy-cloud-mysql
  11. ports:
  12. - 3309:3306
  13. volumes:
  14. - /mnt/product/cloud/mysql/data:/var/lib/mysql #挂载 MySQL数据
  15. - /mnt/product/cloud/mysql/conf/my.cnf:/etc/mysql/my.cnf #挂载 mysql配置
  16. hostname: happy-cloud-mysql
  17. networks:
  18. - custom_net
  19. happy-cloud-redis:
  20. image: redis:5.0
  21. #宿主机端口修改,避免冲突
  22. ports:
  23. - 16379:6379
  24. restart: always
  25. #以docker下的/usr/local/etc/redis/redis.conf为配置文件启动
  26. command: redis-server /usr/local/etc/redis/redis.conf --appendonly yes
  27. volumes:
  28. - /mnt/product/cloud/redis/data:/data #挂载 Redis数据
  29. - /mnt/product/cloud/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf #挂载 Redis配置
  30. container_name: happy-cloud-redis
  31. hostname: happy-cloud-redis
  32. networks:
  33. - custom_net
  34. networks:
  35. custom_net:
  36. external:
  37. name: app_net