Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure and rewrite network content #5936

Merged
merged 3 commits into from Feb 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 37 additions & 35 deletions _data/toc.yaml
Expand Up @@ -207,10 +207,6 @@ guides:
path: /get-started/part5/
- title: "Part 6: Deploy your app"
path: /get-started/part6/
- sectiontitle: Learn by example
section:
- path: /engine/tutorials/networkingcontainers/
title: Network containers
- path: /engine/docker-overview/
title: Docker overview
- sectiontitle: Develop with Docker
Expand Down Expand Up @@ -243,39 +239,45 @@ guides:
title: Overview
- path: /develop/sdk/examples/
title: SDK and API examples

- sectiontitle: Configure networking
section:
- path: /engine/userguide/networking/
title: Docker container networking
- path: /engine/userguide/networking/work-with-networks/
title: Work with network commands
- path: /engine/swarm/networking/
title: Manage swarm service networks
- path: /engine/userguide/networking/overlay-standalone-swarm/
title: Multi-host networking with standalone swarms
- path: /engine/userguide/networking/get-started-macvlan/
title: Get started with macvlan network driver
- path: /engine/userguide/networking/overlay-security-model/
title: Swarm mode overlay network security model
- path: /engine/userguide/networking/configure-dns/
title: Configure container DNS in user-defined networks
- sectiontitle: Default bridge network
section:
- path: /engine/userguide/networking/default_network/dockerlinks/
title: Legacy container links
- path: /engine/userguide/networking/default_network/binding/
title: Bind container ports to the host
- path: /engine/userguide/networking/default_network/build-bridges/
title: Build your own bridge
- path: /engine/userguide/networking/default_network/configure-dns/
title: Configure container DNS
- path: /engine/userguide/networking/default_network/custom-docker0/
title: Customize the docker0 bridge
- path: /engine/userguide/networking/default_network/container-communication/
title: Understand container communication
- path: /engine/userguide/networking/default_network/ipv6/
title: IPv6 with Docker
- path: /network/
title: Networking overview
- path: /network/bridge/
title: Use bridge networks
- path: /network/overlay/
title: Use overlay networks
- path: /network/host/
title: Use host networking
- path: /network/macvlan/
title: Use Macvlan networks
- path: /network/none/
title: Disable networking for a container
- sectiontitle: Networking tutorials
section:
- path: /network/network-tutorial-standalone/
title: Bridge network tutorial
- path: /network/network-tutorial-host/
title: Host networking tutorial
- path: /network/network-tutorial-overlay/
title: Overlay networking tutorial
- path: /network/network-tutorial-macvlan/
title: Macvlan network tutorial
- sectiontitle: Configure the daemon and containers
section:
- path: /config/daemon/ipv6/
title: Configure the daemon for IPv6
- path: /network/iptables/
title: Docker and iptables
- path: /config/containers/container-networking/
title: Container networking
- sectiontitle: Legacy networking content
section:
- path: /network/links/
title: (Legacy) Container links
- path: /network/overlay-standalone.swarm/
title: Overlay networks for Swarm Classic

- sectiontitle: Manage application data
section:
- path: /storage/
Expand Down
65 changes: 65 additions & 0 deletions config/containers/container-networking.md
@@ -0,0 +1,65 @@
---
title: Container networking
description: How networking works from the container's point of view
keywords: networking, container, standalone
redirect_from:
- /engine/userguide/networking/configure-dns/
- /engine/userguide/networking/default_network/binding/
---

The type of network a container uses, whether it is a [brudge](bridges.md), an
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/brudge/bridge/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this will be fixed in #5945. As this content is now live, please file new issues when you see problems.

[overlay](overlay.md), a [macvlan network](macvlan.md), or a custom network
plugin, is transparent from within the container. From the container's point of
view, it has a network interface with an IP address, a gateway, a routing table,
DNS services, and other networking details (assuming the container is not using
the `none` network driver). This topic is about networking concerns from the
point of view of the container.

## Published ports

By default, when you create a container, it does not publish any of its ports
to the outside world. To make a port available to services outside of Docker, or
to Docker containers which are not connected to the container's network, use the
`--publish` or `-p` flag. This creates a firewall rule which maps a container
port to a port on the Docker host. Here are some examples.

| Flag value | Description |
|---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `-p 8080:80` | Map TCP port 80 in the container to port 8080 on the Docker host. |
| `-p 8080:80/udp` | Map UDP port 80 in the container to port 8080 on the Docker host. |
| `-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. |

## IP address and hostname

By default, the container is assigned an IP address for every Docker network it
connects to. The IP address is assigned from the pool assigned to
the network, so the Docker daemon effectively acts as a DHCP server for each
container. Each network also has a default subnet mask and gateway.

When the container starts, it can only be connected to a single network, using
`--network`. However, you can connect a running container to multiple
networks using `docker network connect`. When you start a container using the
`--network` flag, you can specify the IP address assigned to the container on
that network using the `--ip` or `--ip6` flags.

When you connect an existing container to a different network using
`docker network connect`, you can use the `--ip` or `--ip6` flags on that
command to specify the container's IP address on the additional network.

In the same way, a container's hostname defaults to be the container's name in
Docker. You can override the hostname using `--hostname`. When connecting to an
existing network using `docker network connect`, you can use the `--alias`
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
settings on a per-container basis.

| Flag | Description |
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--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. |
| `--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 name if not specified. |
38 changes: 38 additions & 0 deletions config/daemon/ipv6.md
@@ -0,0 +1,38 @@
---
title: Enable IPv6 support
description: How to enable IPv6 support in the Docker daemon
keywords: daemon, network, networking, ipv6
redirect_from:
- /engine/userguide/networking/default_network/ipv6/
---

Before you can use IPv6 in Docker containers or swarm services, you need to
enable IPv6 support in the Docker daemon. Afterward, you can choose to use
either IPv4 or IPv6 (or both) with any container, service, or network.

> **Note**: IPv6 networking is only supported on Docker daemons running on Linux
> hosts.

1. Edit `/etc/docker/daemon.json` and set the `ipv6` key to `true`.

```json
{
"ipv6": true
}
```

Save the file.

2. Reload the Docker configuration file.

```bash
$ systemctl reload docker
```

You can now create networks with the `--ipv6` flag and assign containers IPv6
addresses using the `--ip6` flag.

## Next steps

- [Networking overview](/network/index.md)
- [Container networking](/config/container/container-networking.md)
5 changes: 5 additions & 0 deletions config/daemon/systemd.md
Expand Up @@ -136,6 +136,11 @@ you need to add this configuration in the Docker systemd service file.
Environment=HTTPS_PROXY=https://proxy.example.com:443/
```

## Configure where the Docker daemon listens for connections

See
[Configure where the Docker daemon listens for connections](/install/linux/linux-postinstall.md#control-where-the-docker-daemon-listens-for-connections).

## Manually create the systemd unit files

When installing the binary without a package, you may want
Expand Down
135 changes: 0 additions & 135 deletions engine/userguide/networking/configure-dns.md

This file was deleted.