docker-compose-env.yml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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:5
  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:7.6.2
  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. - 9300:9300
  55. logstash:
  56. image: logstash:7.6.2
  57. container_name: logstash
  58. environment:
  59. - TZ=Asia/Shanghai
  60. volumes:
  61. - /mydata/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf #挂载logstash的配置文件
  62. depends_on:
  63. - elasticsearch #kibana在elasticsearch启动之后再启动
  64. links:
  65. - elasticsearch:es #可以用es这个域名访问elasticsearch服务
  66. ports:
  67. - 4560:4560
  68. - 4561:4561
  69. - 4562:4562
  70. - 4563:4563
  71. kibana:
  72. image: kibana:7.6.2
  73. container_name: kibana
  74. links:
  75. - elasticsearch:es #可以用es这个域名访问elasticsearch服务
  76. depends_on:
  77. - elasticsearch #kibana在elasticsearch启动之后再启动
  78. environment:
  79. - "elasticsearch.hosts=http://es:9200" #设置访问elasticsearch的地址
  80. ports:
  81. - 5601:5601
  82. mongo:
  83. image: mongo:4.2.5
  84. container_name: mongo
  85. volumes:
  86. - /mydata/mongo/db:/data/db #数据文件挂载
  87. ports:
  88. - 27017:27017