docker compose启动中间件-2024
这里只展示yml文件怎么配置
version: '3'
services:
mysql:
image: mysql:5.7
container_name: mysql
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --lower_case_table_names=1
restart: always
environment:
MYSQL_ROOT_PASSWORD: root #设置root帐号密码
ports:
- 3306:3306
volumes:
- /mydata/mysql/data/db:/var/lib/mysql #数据文件挂载
- /mydata/mysql/data/conf:/etc/mysql/conf.d #配置文件挂载
- /mydata/mysql/log:/var/log/mysql #日志文件挂载
redis:
image: redis:6
restart: always
container_name: redis
command: redis-server --appendonly yes
volumes:
- /mydata/redis/data:/data #数据文件挂载
ports:
- 6379:6379
nginx:
image: nginx:1.20.2
container_name: nginx
restart: always
volumes:
- /mydata/nginx/nginx.conf:/etc/nginx/nginx.conf #配置文件挂载
- /mydata/nginx/html:/usr/share/nginx/html #静态资源根目录挂载
- /mydata/nginx/log:/var/log/nginx #日志文件挂载
ports:
- 80:80
nacos:
image: nacos/nacos-server:1.4.2
container_name: nacos
env_file:
- /mydata/nacos/env/nacos-standlone-mysql.env
volumes:
- /mydata/nacos/standalone-logs/:/home/nacos/logs
ports:
- 8848:8848
links:
- mysql:mysql
depends_on:
- mysql
restart: always
minio:
image: minio/minio:latest
container_name: minio
ports:
- "9000:9000"
- "9001:9001"
restart: always
command: server --address ':9000' --console-address ':9001' /data
environment:
# 时区上海
TZ: Asia/Shanghai
# 管理后台用户名
MINIO_ROOT_USER: admin
# 管理后台密码,最小8个字符
MINIO_ROOT_PASSWORD: admin123456
MINIO_PROMETHEUS_AUTH_TYPE: public
MINIO_ACCESS_KEY: root
MINIO_SECRET_KEY: root123456
volumes:
- /mydata/minio/data:/data
seata-server:
image: seataio/seata-server:1.4.2
container_name: seata-server
hostname: seata-server
restart: always
ports:
- "8091:8091"
links:
- mysql:db
- nacos:nacos
depends_on:
- nacos
environment:
- SEATA_PORT=8091
- SEATA_IP=192.168.100.75
- SEATA_CONFIG_NAME=file:/root/seata-config/registry
volumes:
- "/mydata/seata/config:/root/seata-config"
mongodb:
image: mongo:4.2.8
container_name: mongo
environment:
- MONGO_INITDB_ROOT_USERNAME=mongo
- MONGO_INITDB_ROOT_PASSWORD=root
restart: always
ports:
- 27017:27017
volumes:
- /mydata/mongodb/db:/data/db