Advisory: This site contains documentation for the v1.12 release candidate version of Docker Engine. For the Docker Engine v1.11 docs, see https://docs.docker.com/v1.11/. Docker for Mac and Docker for Windows are currently in Beta.
The information in this section covers the embedded DNS server operation for
containers in user-defined networks. DNS lookup for containers connected to
user-defined networks works differently compared to the containers connected
default bridge network.
Note: In order to maintain backward compatibility, the DNS configuration in
default bridgenetwork is retained with no behavioral change. Please refer to the DNS in default bridge network for more information on DNS configuration in the
As of Docker 1.10, the docker daemon implements an embedded DNS server which
provides built-in service discovery for any container created with a valid
net-alias or aliased by
link. The exact details of how Docker
manages the DNS configurations inside the container can change from one Docker
version to the next. So you should not assume the way the files such as
/etc/resolv.conf are managed inside the containers and leave
the files alone and use the following Docker options instead.
Various container options that affect container domain name services.
Container name configured using
In addition to
Using this option as you
The IP addresses passed via the
Sets the domain names that are searched when a bare unqualified hostname is
used inside of the container. These
Sets the options used by DNS resolvers. These options are managed by the embedded
DNS server and will not be updated in the container's
See documentation for
In the absence of the
--dns-opt=OPTION... options, Docker uses the
/etc/resolv.conf of the
host machine (where the
docker daemon runs). While doing so the daemon
filters out all localhost IP address
nameserver entries from the host’s
Filtering is necessary because all localhost addresses on the host are
unreachable from the container’s network. After this filtering, if there are
nameserver entries left in the container’s
the daemon adds public Google DNS nameservers (22.214.171.124 and 126.96.36.199) to the
container’s DNS configuration. If IPv6 is enabled on the daemon, the public
IPv6 Google DNS nameservers will also be added (2001:4860:4860::8888 and
Note: If you need access to a host’s localhost resolver, you must modify your DNS service on the host to listen on a non-localhost address that is reachable from within the container.