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