docker-compose.yaml
version: '3.9'
services:
core:
depends_on:
mysql:
condition: service_healthy
mysql:
image: mysql:8.0.32
container_name: mysql:8.0.32
restart: always
command: --default-authentication-plugin=mysql_native_password
environment:
DB_PORT: $DB_PORT
MYSQL_ROOT_PASSWORD: $DB_PASSWORD
MYSQL_DATABASE: $DB_NAME
volumes:
- ./my.cnf/mysql/my.cnf:/etc/mysql/my.cnf
- ./mysql/data:/var/lib/mysql
healthcheck:
test: "mysql -h127.0.0.1 -P$$DB_PORT -uroot -p$$MYSQL_ROOT_PASSWORD -e 'SHOW DATABASES;'"
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
networks:
- mysql
networks:
mysql:
driver: bridge
标签:8.0,compose,DB,cnf,mysql,docker,PORT From: https://www.cnblogs.com/wangguishe/p/17296905.html