DNS resolution inside container

Hello everyone,

I have a little question about DNS resolution inside a container:

My docker on Ubuntu is working normaly and it can resolve nameserver inside my domain but all the containers installed inside this docker aren’t able to solve.

I already made a research about it and i can add a DNS server with docker run for example:

docker run -d -p 9090:80 -p 5666:5666 -p 5667:5667 –dns --restart always --name nagiosxi tgoetheyn/docker-nagiosxi

But i don’t wan’t remove this container to make another docker setting this comand. It’s possible to add this command –dns inside this running container without losing any data?

I can insert the dns resolution inside /etc/hosts file but if this host just restart i lose all the data saved inside the file.

Hey, guys!!

I already solved my issue doing an image commit and running the same imagem add my config with –dns

docker commit ‘id volume’ ‘id image:versionX’

But if someone know another method more easy to solve this it will help a lot. :smiley:

I now know the issue affects UDP only and I can work-around the issue using:

# head -1 /etc/sysconfig/docker
OPTIONS="--dns= --dns= --dns-search=example.com --dns-opt=use-vc"

Specifying use-vc in resolv.conf tells the resolver to use TCP instead of UDP.