Docker 101 : Container and domain name resolution - DNS -



Docker handles the DNS configuration for its containers.

Docker mounts all the information within the container's filesystem.
The containers use the information available in the host's "/resolv.conf" file. 

Remark:

In case the "/resolv.conf" file is modified, we will need to restart the container for the changes to take effect.

We can define the DNS in a container using the docker command as below:


We could also use the docker daemon file located in the "/etc/default/docker" directory, through the below parameter:


The following command explicitly adds the DNS information to a debian  container along with the network information, in our case the "bridge" type network:


Comments

Leave as a comment:

Archive