Skip to content

Commit a8e84a8

Browse files
Misty Stanley-JonesMisty Stanley-Jones
Misty Stanley-Jones
authored and
Misty Stanley-Jones
committed
Restructure and rewrite network content
1 parent 9d15f4b commit a8e84a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2603
-3207
lines changed

_data/toc.yaml

+37-31
Original file line numberDiff line numberDiff line change
@@ -243,39 +243,45 @@ guides:
243243
title: Overview
244244
- path: /develop/sdk/examples/
245245
title: SDK and API examples
246-
247246
- sectiontitle: Configure networking
248247
section:
249-
- path: /engine/userguide/networking/
250-
title: Docker container networking
251-
- path: /engine/userguide/networking/work-with-networks/
252-
title: Work with network commands
253-
- path: /engine/swarm/networking/
254-
title: Manage swarm service networks
255-
- path: /engine/userguide/networking/overlay-standalone-swarm/
256-
title: Multi-host networking with standalone swarms
257-
- path: /engine/userguide/networking/get-started-macvlan/
258-
title: Get started with macvlan network driver
259-
- path: /engine/userguide/networking/overlay-security-model/
260-
title: Swarm mode overlay network security model
261-
- path: /engine/userguide/networking/configure-dns/
262-
title: Configure container DNS in user-defined networks
263-
- sectiontitle: Default bridge network
264-
section:
265-
- path: /engine/userguide/networking/default_network/dockerlinks/
266-
title: Legacy container links
267-
- path: /engine/userguide/networking/default_network/binding/
268-
title: Bind container ports to the host
269-
- path: /engine/userguide/networking/default_network/build-bridges/
270-
title: Build your own bridge
271-
- path: /engine/userguide/networking/default_network/configure-dns/
272-
title: Configure container DNS
273-
- path: /engine/userguide/networking/default_network/custom-docker0/
274-
title: Customize the docker0 bridge
275-
- path: /engine/userguide/networking/default_network/container-communication/
276-
title: Understand container communication
277-
- path: /engine/userguide/networking/default_network/ipv6/
278-
title: IPv6 with Docker
248+
- path: /network/
249+
title: Networking overview
250+
- path: /network/bridge/
251+
title: Use bridge networks
252+
- path: /network/overlay/
253+
title: Use overlay networks
254+
- path: /network/host/
255+
title: Use host networking
256+
- path: /network/macvlan/
257+
title: Use Macvlan networks
258+
- path: /network/none/
259+
title: Disable networking for a container
260+
- sectiontitle: Networking tutorials
261+
section:
262+
- path: /network/network-tutorial-standalone/
263+
title: Bridge network tutorial
264+
- path: /network/network-tutorial-host/
265+
title: Host networking tutorial
266+
- path: /network/network-tutorial-overlay/
267+
title: Overlay networking tutorial
268+
- path: /network/network-tutorial-macvlan/
269+
title: Macvlan network tutorial
270+
- sectiontitle: Configure the daemon and containers
271+
section:
272+
- path: /config/daemon/ipv6/
273+
title: Configure the daemon for IPv6
274+
- path: /network/iptables/
275+
title: Docker and iptables
276+
- path: /config/containers/container-networking/
277+
title: Container networking
278+
- sectiontitle: Legacy networking content
279+
section:
280+
- path: /network/links/
281+
title: (Legacy) Container links
282+
- path: /network/overlay-standalone.swarm/
283+
title: Overlay networks for Swarm Classic
284+
279285
- sectiontitle: Manage application data
280286
section:
281287
- path: /storage/
+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Container networking
3+
description: How networking works from the container's point of view
4+
keywords: networking, container, standalone
5+
redirect_from:
6+
- /engine/userguide/networking/configure-dns/
7+
- /engine/userguide/networking/default_network/binding/
8+
---
9+
10+
The type of network a container uses, whether it is a [brudge](bridges.md), an
11+
[overlay](overlay.md), a [macvlan network](macvlan.md), or a custom network
12+
plugin, is transparent from within the container. From the container's point of
13+
view, it has a network interface with an IP address, a gateway, a routing table,
14+
DNS services, and other networking details (assuming the container is not using
15+
the `none` network driver). This topic is about networking concerns from the
16+
point of view of the container.
17+
18+
## Published ports
19+
20+
By default, when you create a container, it does not publish any of its ports
21+
to the outside world. To make a port available to services outside of Docker, or
22+
to Docker containers which are not connected to the container's network, use the
23+
`--publish` or `-p` flag. This creates a firewall rule which maps a container
24+
port to a port on the Docker host. Here are some examples.
25+
26+
| Flag value | Description |
27+
|---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
28+
| `-p 8080:80` | Map TCP port 80 in the container to port 8080 on the Docker host. |
29+
| `-p 8080:80/udp` | Map UDP port 80 in the container to port 8080 on the Docker host. |
30+
| `-p 8080:80/tcp -p 8080:80/udp` | Map TCP port 80 in the container to TCP port 8080 on the Docker host, and map UDP port 80 in the container to UDP port 8080 on the Docker host. |
31+
32+
## IP address and hostname
33+
34+
By default, the container is assigned an IP address for every Docker network it
35+
connects to. The IP address is assigned from the pool assigned to
36+
the network, so the Docker daemon effectively acts as a DHCP server for each
37+
container. Each network also has a default subnet mask and gateway.
38+
39+
When the container starts, it can only be connected to a single network, using
40+
`--network`. However, you can connect a running container to multiple
41+
networks using `docker network connect`. When you start a container using the
42+
`--network` flag, you can specify the IP address assigned to the container on
43+
that network using the `--ip` or `--ip6` flags.
44+
45+
When you connect an existing container to a different network using
46+
`docker network connect`, you can use the `--ip` or `--ip6` flags on that
47+
command to specify the container's IP address on the additional network.
48+
49+
In the same way, a container's hostname defaults to be the container's name in
50+
Docker. You can override the hostname using `--hostname`. When connecting to an
51+
existing network using `docker network connect`, you can use the `--alias`
52+
flag to specify an additional network alias for the container on that network.
53+
54+
## DNS services
55+
56+
By default, a container inherits the DNS settings of the Docker daemon,
57+
including the `/etc/hosts` and `/etc/resolv.conf`.You can override these
58+
settings on a per-container basis.
59+
60+
| Flag | Description |
61+
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
62+
| `--dns` | The IP address of a DNS server. To specify multiple DNS servers, use multiple `--dns` flags. If the container cannot reach any of the IP addresses you specify, Google's public DNS server `8.8.8.8` is added, so that your container can resolve internet domains. |
63+
| `--dns-search` | A DNS search domain to search non-fully-qualified hostnames. To specify multiple DNS search prefixes, use multiple `--dns-search` flags. |
64+
| `--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. |
65+
| `--hostname` | The hostname a container uses for itself. Defaults to the container's name if not specified. |

config/daemon/ipv6.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Enable IPv6 support
3+
description: How to enable IPv6 support in the Docker daemon
4+
keywords: daemon, network, networking, ipv6
5+
redirect_from:
6+
- /engine/userguide/networking/default_network/ipv6/
7+
---
8+
9+
Before you can use IPv6 in Docker containers or swarm services, you need to
10+
enable IPv6 support in the Docker daemon. Afterward, you can choose to use
11+
either IPv4 or IPv6 (or both) with any container, service, or network.
12+
13+
> **Note**: IPv6 networking is only supported on Docker daemons running on Linux
14+
> hosts.
15+
16+
1. Edit `/etc/docker/daemon.json` and set the `ipv6` key to `true`.
17+
18+
```json
19+
{
20+
"ipv6": true
21+
}
22+
```
23+
24+
Save the file.
25+
26+
2. Reload the Docker configuration file.
27+
28+
```bash
29+
$ systemctl reload docker
30+
```
31+
32+
You can now create networks with the `--ipv6` flag and assign containers IPv6
33+
addresses using the `--ip6` flag.
34+
35+
## Next steps
36+
37+
- [Networking overview](/network/index.md)
38+
- [Container networking](/config/container/container-networking.md)

engine/userguide/networking/configure-dns.md

-135
This file was deleted.

0 commit comments

Comments
 (0)