我正在尝试使用主机dns resolve.conf
设置。当我启动单个应用程序容器时,我可以看到正确的resolve.conf并能够正确ping通我的网络内主机名。但是,当我在docker中添加数据库并启动容器时,我的dns设置更改为以下内容,并且无法ping通我的网络主机名:
/etc $ cat resolv.conf
search mydomain.com
nameserver 127.0.0.11
options ndots:0
/etc $ ping other_hostname
ping: bad address 'other_hostname'
docker-compose:
version: "2.1"
services:
db:
image: mysql:5.7
env_file: .env
ports:
- "3306:3306"
environment:
- MYSQL_DATABASE=usb
- MYSQL_USER=supv
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
volumes:
- ./db:/docker-entrypoint-initdb.d/:ro
app:
build: ./
ports:
- "2222:22"
- "5000:5000"
depends_on:
- "db"
command: sh -c "/usr/local/bin/start.sh"
volumes:
- ./start.sh:/usr/local/bin/start.sh
有人知道为什么在使用docker-compose时会更改resolve.conf
吗?