2024-05-22 17:26:00 +08:00
|
|
|
version: "3.9"
|
|
|
|
|
|
|
|
services:
|
|
|
|
mysql:
|
2024-11-11 21:39:00 +08:00
|
|
|
image: mysql:8.0.40
|
2024-05-22 17:26:00 +08:00
|
|
|
container_name: mysql
|
|
|
|
hostname: mysql
|
|
|
|
restart: always
|
|
|
|
networks:
|
|
|
|
- db_network
|
|
|
|
ports:
|
|
|
|
- "3306:3306"
|
|
|
|
volumes:
|
|
|
|
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro
|
|
|
|
- ./data:/var/lib/mysql
|
|
|
|
- ./conf/my.cnf:/etc/mysql/conf.d/my.cnf
|
|
|
|
- ./conf/root.key:/etc/mysql/conf.d/root.key
|
|
|
|
environment:
|
|
|
|
- MYSQL_ROOT_PASSWORD_FILE=/etc/mysql/conf.d/root.key
|
|
|
|
|
|
|
|
networks:
|
|
|
|
db_network:
|
|
|
|
name: db_network
|
|
|
|
external: true
|
|
|
|
# driver: bridge
|
|
|
|
# driver_opts:
|
|
|
|
# encrypted: 'true'
|
|
|
|
# ipam:
|
|
|
|
# driver: default
|
|
|
|
# config:
|
|
|
|
# - subnet: 10.21.22.1/24
|