From 9193473df51ba42508d0bbb4d74cb19e7378d99a Mon Sep 17 00:00:00 2001 From: mjchi7 <40532196+mjchi7@users.noreply.github.com> Date: Thu, 18 Jun 2020 22:32:20 +0800 Subject: [PATCH] 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 https://github.com/moby/moby/issues/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 Co-authored-by: Sebastiaan van Stijn --- config/containers/container-networking.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/config/containers/container-networking.md b/config/containers/container-networking.md index a28e1d5b9b..e58db37ebc 100644 --- a/config/containers/container-networking.md +++ b/config/containers/container-networking.md @@ -56,8 +56,17 @@ flag to specify an additional network alias for the container on that network. ## DNS services -By default, a container inherits the DNS settings of the Docker daemon, -including the `/etc/hosts` and `/etc/resolv.conf`.You can override these +By default, a container inherits the DNS settings of the host, as defined in the +`/etc/resolv.conf` configuration file. Containers that use the default `bridge` +network get a copy of this file, whereas containers that use a +[custom network](../../network/network-tutorial-standalone.md#use-user-defined-bridge-networks) +use Docker's embedded DNS server, which forwards external DNS lookups to the DNS +servers configured on the host. + +Custom hosts defined in `/etc/hosts` are not inherited. To pass additional hosts +into your container, refer to [add entries to container hosts file](../../engine/reference/commandline/run.md#add-entries-to-container-hosts-file---add-host) +in the `docker run` reference documentation. You can override these settings on +a per-container basis. settings on a per-container basis. | Flag | Description |