docker-compose-env.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. version: '3'
  2. services:
  3. mysql:
  4. image: mysql:5.7
  5. container_name: mysql
  6. command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
  7. restart: always
  8. environment:
  9. MYSQL_ROOT_PASSWORD: root #设置root帐号密码
  10. ports:
  11. - 3306:3306
  12. volumes:
  13. - /mydata/mysql/data/db:/var/lib/mysql #数据文件挂载
  14. - /mydata/mysql/data/conf:/etc/mysql/conf.d #配置文件挂载
  15. - /mydata/mysql/log:/var/log/mysql #日志文件挂载
  16. redis:
  17. image: redis:3.2
  18. container_name: redis
  19. command: redis-server --appendonly yes
  20. volumes:
  21. - /mydata/redis/data:/data #数据文件挂载
  22. ports:
  23. - 6379:6379
  24. nginx:
  25. image: nginx:1.10
  26. container_name: nginx
  27. volumes:
  28. - /mydata/nginx/nginx.conf:/etc/nginx/nginx.conf #配置文件挂载
  29. - /mydata/nginx/html:/usr/share/nginx/html #静态资源根目录挂载
  30. - /mydata/nginx/log:/var/log/nginx #日志文件挂载
  31. ports:
  32. - 80:80
  33. rabbitmq:
  34. image: rabbitmq:3.7.15-management
  35. container_name: rabbitmq
  36. volumes:
  37. - /mydata/rabbitmq/data:/var/lib/rabbitmq #数据文件挂载
  38. - /mydata/rabbitmq/log:/var/log/rabbitmq #日志文件挂载
  39. ports:
  40. - 5672:5672
  41. - 15672:15672
  42. elasticsearch:
  43. image: elasticsearch:6.4.0
  44. container_name: elasticsearch
  45. environment:
  46. - "cluster.name=elasticsearch" #设置集群名称为elasticsearch
  47. - "discovery.type=single-node" #以单一节点模式启动
  48. - "ES_JAVA_OPTS=-Xms512m -Xmx512m" #设置使用jvm内存大小
  49. volumes:
  50. - /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins #插件文件挂载
  51. - /mydata/elasticsearch/data:/usr/share/elasticsearch/data #数据文件挂载
  52. ports:
  53. - 9200:9200
  54. kibana:
  55. image: kibana:6.4.0
  56. container_name: kibana
  57. links:
  58. - elasticsearch:es #可以用es这个域名访问elasticsearch服务
  59. depends_on:
  60. - elasticsearch #kibana在elasticsearch启动之后再启动
  61. environment:
  62. - "elasticsearch.hosts=http://es:9200" #设置访问elasticsearch的地址
  63. ports:
  64. - 5601:5601
  65. mongo:
  66. image: mongo:3.2
  67. container_name: mongo
  68. volumes:
  69. - /mydata/mongo/db:/data/db #数据文件挂载
  70. ports:
  71. - 27017:27017