我有下一个docker-compose.yml
version: '3'
services:
webserver:
build: './Docker/apache-php/'
depends_on:
- db
ports:
- "80:80"
volumes:
- ./:/var/www/html/
db:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: dmm
MYSQL_USER: dmm
MYSQL_PASSWORD: password
那很好。我可以使用db:3306
地址从Web服务器连接到数据库。
但是,如果我向db容器中添加任何卷
version: '3'
services:
webserver:
build: './Docker/apache-php/'
depends_on:
- db
ports:
- "80:80"
volumes:
- ./:/var/www/html/
db:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: dmm
MYSQL_USER: dmm
MYSQL_PASSWORD: password
volumes:
- ./db/:/var/lib/mysql/
db:3306
拒绝所有连接
怎么了?