version: '3'
networks:
mynetwork:
driver: bridge
services:
mysql:
image: mysql:8.0.24
container_name: mysql
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always
networks:
- mynetwork
environment:
TZ: Asia/Shanghai # 设置容器时区与宿主机保持一致
MYSQL_ROOT_PASSWORD: root #设置root帐号密码
ports:
- 3306:3306
volumes:
- /data/mysql/data:/var/lib/mysql #数据文件挂载
- /data/mysql/conf:/etc/mysql/conf.d #配置文件挂载
- /data/mysql/log:/var/log/mysql #日志文件挂载
redis:
image: redis:5
container_name: redis
restart: always
networks:
- mynetwork
command: redis-server --appendonly yes --requirepass root
volumes:
- /data/redis/data:/data #数据文件挂载
ports:
- 6379:6379
rabbitmq:
image: rabbitmq:3.7.15-management
container_name: rabbitmq
restart: always
networks:
- mynetwork
#command: /bin/bash -c "rabbitmqctl add_user admin admin && rabbitmqctl set_user_tags admin administrator"
environment:
TZ: Asia/Shanghai
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: 123456
volumes:
- /data/rabbitmq/data:/var/lib/rabbitmq #数据文件挂载
- /data/rabbitmq/log:/var/log/rabbitmq #日志文件挂载
ports:
- 5672:5672
- 15672:15672
网友评论