A '--dns' server will not be replaced by default DNS

Google's DNS servers are currently used by containers on the default
bridge network, when none of the host's /etc/resolv.conf nameservers
are usable (host loopback addresses that the container can't see).

But, if a server is supplied via the --dns option, it'll just appear
in the container's resolv.conf (on the default bridge) or as an
upstream server for the internal resolver.

So, fix the networking-intro page's description, noting that requests
to --dns servers happen in the container's namespace.

Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
Rob Murray 2024-05-16 12:08:09 +01:00
parent 9dacd32d30
commit c3af3de173
1 changed files with 6 additions and 6 deletions

View File

@ -167,12 +167,12 @@ You can configure DNS resolution on a per-container basis, using flags for the
The following table describes the available `docker run` flags related to DNS
configuration.
| Flag | Description |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--dns` | The IP address of a DNS server. To specify multiple DNS servers, use multiple `--dns` flags. If the container can't reach any of the IP addresses you specify, it uses Google's public DNS server at `8.8.8.8`. This allows containers to resolve internet domains. |
| `--dns-search` | A DNS search domain to search non-fully qualified hostnames. To specify multiple DNS search prefixes, use multiple `--dns-search` flags. |
| `--dns-opt` | A key-value pair representing a DNS option and its value. See your operating system's documentation for `resolv.conf` for valid options. |
| `--hostname` | The hostname a container uses for itself. Defaults to the container's ID if not specified. |
| Flag | Description |
| -------------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--dns` | The IP address of a DNS server. To specify multiple DNS servers, use multiple `--dns` flags. DNS requests will be forwarded from the container's network namespace so, for example, `--dns=127.0.0.1` refers to the container's own loopback address. |
| `--dns-search` | A DNS search domain to search non-fully qualified hostnames. To specify multiple DNS search prefixes, use multiple `--dns-search` flags. |
| `--dns-opt` | A key-value pair representing a DNS option and its value. See your operating system's documentation for `resolv.conf` for valid options. |
| `--hostname` | The hostname a container uses for itself. Defaults to the container's ID if not specified. |
### Custom hosts