You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -104,6 +103,30 @@ You can override these settings on a per-container basis.
104
103
| `--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. |
105
104
| `--hostname` | The hostname a container uses for itself. Defaults to the container's ID if not specified. |
106
105
106
+
### Name resolution with multiple nameservers
107
+
108
+
When you specify multiple DNS servers using `--dns` flags, name resolution may
109
+
work in a surprising or unexpected way. DNS lookup behavior depends on a number
110
+
of different factors:
111
+
112
+
- Whether the container OS runs on [musl or glibc](https://wiki.musl-libc.org/functional-differences-from-glibc.html#Name_Resolver/DNS){: target="blank" rel="noopener" }
113
+
- Whether the Docker daemon binary was [statically or dynamically linked](https://pkg.go.dev/net#hdr-Name_Resolution){: target="blank" rel="noopener" }
114
+
- If dynamically linked, which version of glibc that's used
115
+
- Whether or not [nsswitch.conf is present](https://tldp.org/LDP/nag2/x-087-2-resolv.library.html#X-087-2-RESOLV.NSSWITCH-CONF){: target="blank" rel="noopener" }
116
+
117
+
You may find that name resolution works as follows:
118
+
119
+
1. The container emits requests to **all** nameservers that you specify.
120
+
2. The container uses the first response returned by any of the nameservers.
121
+
Even if the first response is `NXDOMAIN`, or similar.
122
+
123
+
### Custom hosts
124
+
125
+
Custom hosts, defined in `/etc/hosts` on the host machine, aren't inherited by containers.
126
+
To pass additional hosts into container, refer to
127
+
[add entries to container hosts file](../engine/reference/commandline/run.md#add-host)
128
+
in the `docker run` reference documentation.
129
+
107
130
## Proxy server
108
131
109
132
If your container needs to use a proxy server, see
0 commit comments