Skip to content

Commit 9193473

Browse files
mjchi7thaJeztah
andauthored
Removed wrong information about container DNS (#11012)
* Removed wrong information about container DNS In the docs it says a container will inherit the host /etc/hosts file along with /etc/resolv.conf. While the latter part is correct, /etc/hosts will not actually be inherited, as reported moby/moby#39311. An additional line of text has been added to emphasize the fact that /etc/hosts are not inherited * Removed extra hash on the run command redirect * Update config/containers/container-networking.md Co-authored-by: Sebastiaan van Stijn <thaJeztah@users.noreply.github.com> Co-authored-by: Sebastiaan van Stijn <thaJeztah@users.noreply.github.com>
1 parent 37e0f5c commit 9193473

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

config/containers/container-networking.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,17 @@ flag to specify an additional network alias for the container on that network.
5656

5757
## DNS services
5858

59-
By default, a container inherits the DNS settings of the Docker daemon,
60-
including the `/etc/hosts` and `/etc/resolv.conf`.You can override these
59+
By default, a container inherits the DNS settings of the host, as defined in the
60+
`/etc/resolv.conf` configuration file. Containers that use the default `bridge`
61+
network get a copy of this file, whereas containers that use a
62+
[custom network](../../network/network-tutorial-standalone.md#use-user-defined-bridge-networks)
63+
use Docker's embedded DNS server, which forwards external DNS lookups to the DNS
64+
servers configured on the host.
65+
66+
Custom hosts defined in `/etc/hosts` are not inherited. To pass additional hosts
67+
into your container, refer to [add entries to container hosts file](../../engine/reference/commandline/run.md#add-entries-to-container-hosts-file---add-host)
68+
in the `docker run` reference documentation. You can override these settings on
69+
a per-container basis.
6170
settings on a per-container basis.
6271

6372
| Flag | Description |

0 commit comments

Comments
 (0)