@@ -5,16 +5,16 @@ weight: 30
55description : Learn how networking works from the container's point of view
66keywords : networking, container, standalone, IP address, DNS resolution
77aliases :
8- - /articles/networking/
9- - /config/containers/container-networking/
10- - /engine/tutorials/networkingcontainers/
11- - /engine/userguide/networking/
12- - /engine/userguide/networking/configure-dns/
13- - /engine/userguide/networking/default_network/binding/
14- - /engine/userguide/networking/default_network/configure-dns/
15- - /engine/userguide/networking/default_network/container-communication/
16- - /engine/userguide/networking/dockernetworks/
17- - /network/
8+ - /articles/networking/
9+ - /config/containers/container-networking/
10+ - /engine/tutorials/networkingcontainers/
11+ - /engine/userguide/networking/
12+ - /engine/userguide/networking/configure-dns/
13+ - /engine/userguide/networking/default_network/binding/
14+ - /engine/userguide/networking/default_network/configure-dns/
15+ - /engine/userguide/networking/default_network/container-communication/
16+ - /engine/userguide/networking/dockernetworks/
17+ - /network/
1818---
1919
2020Container networking refers to the ability for containers to connect to and
@@ -79,7 +79,7 @@ Docker Engine has a number of network drivers, as well as the default "bridge".
7979On Linux, the following built-in network drivers are available:
8080
8181| Driver | Description |
82- | :-------------------------------- | :-------------------------------------------------------------------- |
82+ | :------------------------------ | :------------------------------------------------------------------ |
8383| [ bridge] ( ./drivers/bridge.md ) | The default network driver. |
8484| [ host] ( ./drivers/host.md ) | Remove network isolation between the container and the Docker host. |
8585| [ none] ( ./drivers/none.md ) | Completely isolate a container from the host and other containers. |
@@ -192,21 +192,21 @@ These pools can be configured in `/etc/docker/daemon.json`. Docker's built-in de
192192``` json
193193{
194194 "default-address-pools" : [
195- {"base" :" 172.17.0.0/16" ,"size" :16 },
196- {"base" :" 172.18.0.0/16" ,"size" :16 },
197- {"base" :" 172.19.0.0/16" ,"size" :16 },
198- {"base" :" 172.20.0.0/14" ,"size" :16 },
199- {"base" :" 172.24.0.0/14" ,"size" :16 },
200- {"base" :" 172.28.0.0/14" ,"size" :16 },
201- {"base" :" 192.168.0.0/16" ,"size" :20 }
195+ { "base" : " 172.17.0.0/16" , "size" : 16 },
196+ { "base" : " 172.18.0.0/16" , "size" : 16 },
197+ { "base" : " 172.19.0.0/16" , "size" : 16 },
198+ { "base" : " 172.20.0.0/14" , "size" : 16 },
199+ { "base" : " 172.24.0.0/14" , "size" : 16 },
200+ { "base" : " 172.28.0.0/14" , "size" : 16 },
201+ { "base" : " 192.168.0.0/16" , "size" : 20 }
202202 ]
203203}
204204```
205205
206206- ` base ` : The subnet that can be allocated from.
207207- ` size ` : The prefix length used for each allocated subnet.
208208
209- When an IPv6 subnet is required and there are no IPv6 addresses in ` default-address-pools ` , Docker allocates
209+ When an IPv6 subnet is required and there are no IPv6 addresses in ` default-address-pools ` , Docker allocates
210210subnets from a Unique Local Address (ULA) prefix. To use specific IPv6 subnets instead, add them to your
211211` default-address-pools ` . See [ Dynamic IPv6 subnet allocation] ( ../daemon/ipv6.md#dynamic-ipv6-subnet-allocation )
212212for more information.
@@ -222,9 +222,7 @@ Docker will allocate subnets `172.17.0.0/24`, `172.17.1.0/24`, and so on, up to
222222
223223``` json
224224{
225- "default-address-pools" : [
226- {"base" : " 172.17.0.0/16" , "size" : 24 }
227- ]
225+ "default-address-pools" : [{ "base" : " 172.17.0.0/16" , "size" : 24 }]
228226}
229227```
230228
@@ -265,14 +263,17 @@ Containers that attach to a
265263[ custom network] ( drivers/bridge.md#use-user-defined-bridge-networks )
266264use Docker's embedded DNS server.
267265The embedded DNS server forwards external DNS lookups to the DNS servers configured on the host.
266+ The embedded DNS server address is ` 127.0.0.11 ` .
267+ There is no IPv6 equivalent; the IPv4 address works even in IPv6-only containers.
268+ If an application requires an explicit DNS server address, use ` 127.0.0.11 ` .
268269
269270You can configure DNS resolution on a per-container basis, using flags for the
270271` docker run ` or ` docker create ` command used to start the container.
271272The following table describes the available ` docker run ` flags related to DNS
272273configuration.
273274
274275| Flag | Description |
275- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
276+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
276277| ` --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. |
277278| ` --dns-search ` | A DNS search domain to search non-fully qualified hostnames. To specify multiple DNS search prefixes, use multiple ` --dns-search ` flags. |
278279| ` --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. |
0 commit comments