docker-compose-env.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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:/var/lib/mysql #数据文件挂载
  14. - /mydata/mysql/conf:/etc/mysql #配置文件挂载
  15. - /mydata/mysql/log:/var/log/mysql #日志文件挂载
  16. redis:
  17. image: redis:7
  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.22
  26. container_name: nginx
  27. volumes:
  28. - /mydata/nginx/conf:/etc/nginx #配置文件目录挂载
  29. - /mydata/nginx/html:/usr/share/nginx/html #静态资源根目录挂载
  30. - /mydata/nginx/logs:/var/log/nginx #日志文件挂载
  31. ports:
  32. - 80:80
  33. rabbitmq:
  34. image: rabbitmq:3.9.11-management
  35. container_name: rabbitmq
  36. volumes:
  37. - /mydata/rabbitmq/data:/var/lib/rabbitmq #数据文件挂载
  38. ports:
  39. - 5672:5672
  40. - 15672:15672
  41. elasticsearch:
  42. image: elasticsearch:7.17.3
  43. container_name: elasticsearch
  44. environment:
  45. - "cluster.name=elasticsearch" #设置集群名称为elasticsearch
  46. - "discovery.type=single-node" #以单一节点模式启动
  47. - "ES_JAVA_OPTS=-Xms512m -Xmx1024m" #设置使用jvm内存大小
  48. volumes:
  49. - /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins #插件文件挂载
  50. - /mydata/elasticsearch/data:/usr/share/elasticsearch/data #数据文件挂载
  51. ports:
  52. - 9200:9200
  53. - 9300:9300
  54. logstash:
  55. image: logstash:7.17.3
  56. container_name: logstash
  57. environment:
  58. - TZ=Asia/Shanghai
  59. volumes:
  60. - /mydata/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf #挂载logstash的配置文件
  61. depends_on:
  62. - elasticsearch #kibana在elasticsearch启动之后再启动
  63. links:
  64. - elasticsearch:es #可以用es这个域名访问elasticsearch服务
  65. ports:
  66. - 4560:4560
  67. - 4561:4561
  68. - 4562:4562
  69. - 4563:4563
  70. kibana:
  71. image: kibana:7.17.3
  72. container_name: kibana
  73. links:
  74. - elasticsearch:es #可以用es这个域名访问elasticsearch服务
  75. depends_on:
  76. - elasticsearch #kibana在elasticsearch启动之后再启动
  77. environment:
  78. - "elasticsearch.hosts=http://es:9200" #设置访问elasticsearch的地址
  79. ports:
  80. - 5601:5601
  81. mongo:
  82. image: mongo:4
  83. container_name: mongo
  84. volumes:
  85. - /mydata/mongo/db:/data/db #数据文件挂载
  86. ports:
  87. - 27017:27017
  88. minio:
  89. image: minio/minio
  90. container_name: minio
  91. command: server /data --console-address ":9001" #指定数据目录及console运行端口启动
  92. volumes:
  93. - /mydata/minio/data:/data #数据目录挂载
  94. environment:
  95. - "MINIO_ROOT_USER=minioadmin"
  96. - "MINIO_ROOT_PASSWORD=minioadmin"
  97. ports:
  98. - 9090:9000
  99. - 9001:9001