docker-compose/examples/mysql/8/compose/compose.yaml

32 lines
677 B
YAML

version: "3.9"
services:
mysql:
image: mysql:8.0.37
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