I am using a docker-compose command to create and start my containers.
My Docker Version
docker --version Docker version 17.09.0-ce, build afdb6d4
My Docker-Compose version
docker-compose --version docker-compose version 1.16.1, build 6d1ac21
The .yml file that I’m using looks something like this: (Note that I’ve just shortened it to take sensitive things out)
--- services: zookeeper: image: "zookeeper" server-1: cap_add: - "NET_ADMIN" server-0: cap_add: - "NET_ADMIN" dns: - 184.108.40.206 - 220.127.116.11 environment: SERVER_ID: 0 NETEM_HOSTS: "" LOSS_VALUES: "" MAX_RATE_VALUES: "" DELAY_VALUES: "" image: "cloud.mycompany.com:5000/server-0:latest" fakedns: image: "cloud.mycompany.com:5000/fakedns:latest" version: "3.3"
Then I start using:
docker-compose --file compose.yml up -d
My Question is this:
1} After containers come up… when I go into a container, for e.g. in this case server-0, I don’t see the /etc/resolv.conf file updated to use these nameservers. Instead it uses the embedded dns of docker which is 127.0.0.11
2} How do I make sure that it uses what I specify in file that is used by docker-compose
3} I tried to do this with the command and it seems to work, but I need to do from compose-file
docker run -p 4000:53 --dns=18.104.22.168 cloud.mycompany.com:5000/server-0:latest
4} Ideally, I want it to have the IP address of the container ‘fakedns’ so that it uses this one instead of the embedded one @127.0.0.11