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 <thaJeztah@users.noreply.github.com>

Co-authored-by: Sebastiaan van Stijn <thaJeztah@users.noreply.github.com>
This commit is contained in:
mjchi7 2020-06-18 22:32:20 +08:00 committed by GitHub
parent 37e0f5c7de
commit 9193473df5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -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 |