version: "3"
services:
# 数据库服务
db:
image: mysql
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: 123456
command:
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
volumes:
- ./base-services/mysql:/var/lib/mysql
ports:
- "9001:3306"
restart: always
# 缓存服务
redis:
image: redis:6.2.6
volumes:
- ./base-services/redis/redis.conf:/usr/local/redis/redis.conf
- ./base-services/redis/data:/data/
environment:
TZ: Asia/Shanghai
ports:
- "9002:6379"
restart: always
command: ["redis-server","/usr/local/redis/redis.conf"]
# mq服务
mq:
image: rabbitmq:management
environment:
RABBITMQ_DEFAULT_USER: user
RABBITMQ_DEFAULT_PASS: password
ports:
- "9003:5672"
- "9004:15672"
restart: always
volumes:
- ./base-services/mq/data:/var/lib/rabbitmq
# eureka服务
docker-compose编排mysql、rabbitmq、redis基础服务
于 2023-01-03 11:52:22 首次发布
该配置文件定义了三个服务:数据库(MySQL)、缓存(Redis)和消息队列(RabbitMQ)。每个服务都设置了时区,密码和端口映射,并配置了数据卷以持久化数据。此外,还包含了对字符集和排序规则的设置。
摘要由CSDN通过智能技术生成