mirror of https://github.com/docker/cli.git
network docs cleanup
This fixes some Markup and formatting issues in the network documentation; - wrap text to 80 chars - add missing language hints for code examples - add missing line continuations (\) - update USAGE output for Cobra Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
a15b94e1bc
commit
bb0afa7381
|
@ -10,22 +10,27 @@ parent = "smn_cli"
|
||||||
|
|
||||||
# network create
|
# network create
|
||||||
|
|
||||||
Usage: docker network create [OPTIONS] NETWORK-NAME
|
```markdown
|
||||||
|
Usage: docker network create [OPTIONS]
|
||||||
|
|
||||||
Creates a new network with a name specified by the user
|
Create a network
|
||||||
|
|
||||||
--aux-address=map[] Auxiliary ipv4 or ipv6 addresses used by network driver
|
Options:
|
||||||
-d --driver=DRIVER Driver to manage the Network bridge or overlay. The default is bridge.
|
--aux-address value auxiliary ipv4 or ipv6 addresses used by Network
|
||||||
--gateway=[] ipv4 or ipv6 Gateway for the master subnet
|
driver (default map[])
|
||||||
--help Print usage
|
-d, --driver string Driver to manage the Network (default "bridge")
|
||||||
--internal Restricts external access to the network
|
--gateway value ipv4 or ipv6 Gateway for the master subnet (default [])
|
||||||
--ip-range=[] Allocate container ip from a sub-range
|
--help Print usage
|
||||||
--ipam-driver=default IP Address Management Driver
|
--internal restricts external access to the network
|
||||||
--ipam-opt=map[] Set custom IPAM driver specific options
|
--ip-range value allocate container ip from a sub-range (default [])
|
||||||
--ipv6 Enable IPv6 networking
|
--ipam-driver string IP Address Management Driver (default "default")
|
||||||
--label=[] Set metadata on a network
|
--ipam-opt value set IPAM driver specific options (default map[])
|
||||||
-o --opt=map[] Set custom driver specific options
|
--ipv6 enable IPv6 networking
|
||||||
--subnet=[] Subnet in CIDR format that represents a network segment
|
--label value Set metadata on a network (default [])
|
||||||
|
-o, --opt value Set driver specific options (default map[])
|
||||||
|
--subnet value subnet in CIDR format that represents a
|
||||||
|
network segment (default [])
|
||||||
|
```
|
||||||
|
|
||||||
Creates a new network. The `DRIVER` accepts `bridge` or `overlay` which are the
|
Creates a new network. The `DRIVER` accepts `bridge` or `overlay` which are the
|
||||||
built-in network drivers. If you have installed a third party or your own custom
|
built-in network drivers. If you have installed a third party or your own custom
|
||||||
|
@ -51,7 +56,7 @@ conditions are:
|
||||||
* A cluster of hosts with connectivity to the key-value store.
|
* A cluster of hosts with connectivity to the key-value store.
|
||||||
* A properly configured Engine `daemon` on each host in the cluster.
|
* A properly configured Engine `daemon` on each host in the cluster.
|
||||||
|
|
||||||
The `docker daemon` options that support the `overlay` network are:
|
The `dockerd` options that support the `overlay` network are:
|
||||||
|
|
||||||
* `--cluster-store`
|
* `--cluster-store`
|
||||||
* `--cluster-store-opt`
|
* `--cluster-store-opt`
|
||||||
|
@ -98,15 +103,26 @@ disconnect` command.
|
||||||
|
|
||||||
## Specifying advanced options
|
## Specifying advanced options
|
||||||
|
|
||||||
When you create a network, Engine creates a non-overlapping subnetwork for the network by default. This subnetwork is not a subdivision of an existing network. It is purely for ip-addressing purposes. You can override this default and specify subnetwork values directly using the `--subnet` option. On a `bridge` network you can only create a single subnet:
|
When you create a network, Engine creates a non-overlapping subnetwork for the
|
||||||
|
network by default. This subnetwork is not a subdivision of an existing
|
||||||
|
network. It is purely for ip-addressing purposes. You can override this default
|
||||||
|
and specify subnetwork values directly using the `--subnet` option. On a
|
||||||
|
`bridge` network you can only create a single subnet:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker network create --driver=bridge --subnet=192.168.0.0/16 br0
|
$ docker network create --driver=bridge --subnet=192.168.0.0/16 br0
|
||||||
```
|
```
|
||||||
Additionally, you also specify the `--gateway` `--ip-range` and `--aux-address` options.
|
|
||||||
|
Additionally, you also specify the `--gateway` `--ip-range` and `--aux-address`
|
||||||
|
options.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
network create --driver=bridge --subnet=172.28.0.0/16 --ip-range=172.28.5.0/24 --gateway=172.28.5.254 br0
|
$ docker network create \
|
||||||
|
--driver=bridge \
|
||||||
|
--subnet=172.28.0.0/16 \
|
||||||
|
--ip-range=172.28.5.0/24 \
|
||||||
|
--gateway=172.28.5.254 \
|
||||||
|
br0
|
||||||
```
|
```
|
||||||
|
|
||||||
If you omit the `--gateway` flag the Engine selects one for you from inside a
|
If you omit the `--gateway` flag the Engine selects one for you from inside a
|
||||||
|
@ -114,20 +130,25 @@ preferred pool. For `overlay` networks and for network driver plugins that
|
||||||
support it you can create multiple subnetworks.
|
support it you can create multiple subnetworks.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker network create -d overlay
|
$ docker network create -d overlay \
|
||||||
--subnet=192.168.0.0/16 --subnet=192.170.0.0/16
|
--subnet=192.168.0.0/16 \
|
||||||
--gateway=192.168.0.100 --gateway=192.170.0.100
|
--subnet=192.170.0.0/16 \
|
||||||
--ip-range=192.168.1.0/24
|
--gateway=192.168.0.100 \
|
||||||
--aux-address a=192.168.1.5 --aux-address b=192.168.1.6
|
--gateway=192.170.0.100 \
|
||||||
--aux-address a=192.170.1.5 --aux-address b=192.170.1.6
|
--ip-range=192.168.1.0/24 \
|
||||||
|
--aux-address a=192.168.1.5 --aux-address b=192.168.1.6 \
|
||||||
|
--aux-address a=192.170.1.5 --aux-address b=192.170.1.6 \
|
||||||
my-multihost-network
|
my-multihost-network
|
||||||
```
|
```
|
||||||
Be sure that your subnetworks do not overlap. If they do, the network create fails and Engine returns an error.
|
|
||||||
|
Be sure that your subnetworks do not overlap. If they do, the network create
|
||||||
|
fails and Engine returns an error.
|
||||||
|
|
||||||
# Bridge driver options
|
# Bridge driver options
|
||||||
|
|
||||||
When creating a custom network, the default network driver (i.e. `bridge`) has additional options that can be passed.
|
When creating a custom network, the default network driver (i.e. `bridge`) has
|
||||||
The following are those options and the equivalent docker daemon flags used for docker0 bridge:
|
additional options that can be passed. The following are those options and the
|
||||||
|
equivalent docker daemon flags used for docker0 bridge:
|
||||||
|
|
||||||
| Option | Equivalent | Description |
|
| Option | Equivalent | Description |
|
||||||
|--------------------------------------------------|-------------|-------------------------------------------------------|
|
|--------------------------------------------------|-------------|-------------------------------------------------------|
|
||||||
|
@ -137,8 +158,8 @@ The following are those options and the equivalent docker daemon flags used for
|
||||||
| `com.docker.network.bridge.host_binding_ipv4` | `--ip` | Default IP when binding container ports |
|
| `com.docker.network.bridge.host_binding_ipv4` | `--ip` | Default IP when binding container ports |
|
||||||
| `com.docker.network.mtu` | `--mtu` | Set the containers network MTU |
|
| `com.docker.network.mtu` | `--mtu` | Set the containers network MTU |
|
||||||
|
|
||||||
The following arguments can be passed to `docker network create` for any network driver, again with their approximate
|
The following arguments can be passed to `docker network create` for any
|
||||||
equivalents to `docker daemon`.
|
network driver, again with their approximate equivalents to `docker daemon`.
|
||||||
|
|
||||||
| Argument | Equivalent | Description |
|
| Argument | Equivalent | Description |
|
||||||
|--------------|----------------|--------------------------------------------|
|
|--------------|----------------|--------------------------------------------|
|
||||||
|
@ -148,16 +169,21 @@ equivalents to `docker daemon`.
|
||||||
| `--ipv6` | `--ipv6` | Enable IPv6 networking |
|
| `--ipv6` | `--ipv6` | Enable IPv6 networking |
|
||||||
| `--subnet` | `--bip` | Subnet for network |
|
| `--subnet` | `--bip` | Subnet for network |
|
||||||
|
|
||||||
For example, let's use `-o` or `--opt` options to specify an IP address binding when publishing ports:
|
For example, let's use `-o` or `--opt` options to specify an IP address binding
|
||||||
|
when publishing ports:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker network create -o "com.docker.network.bridge.host_binding_ipv4"="172.19.0.1" simple-network
|
$ docker network create \
|
||||||
|
-o "com.docker.network.bridge.host_binding_ipv4"="172.19.0.1" \
|
||||||
|
simple-network
|
||||||
```
|
```
|
||||||
|
|
||||||
### Network internal mode
|
### Network internal mode
|
||||||
|
|
||||||
By default, when you connect a container to an `overlay` network, Docker also connects a bridge network to it to provide external connectivity.
|
By default, when you connect a container to an `overlay` network, Docker also
|
||||||
If you want to create an externally isolated `overlay` network, you can specify the `--internal` option.
|
connects a bridge network to it to provide external connectivity. If you want
|
||||||
|
to create an externally isolated `overlay` network, you can specify the
|
||||||
|
`--internal` option.
|
||||||
|
|
||||||
## Related information
|
## Related information
|
||||||
|
|
||||||
|
|
|
@ -101,12 +101,19 @@ specify subnetwork values directly using the `--subnet` option. On a
|
||||||
`bridge` network you can only create a single subnet:
|
`bridge` network you can only create a single subnet:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker network create -d bridge --subnet=192.168.0.0/16 br0
|
$ docker network create -d bridge --subnet=192.168.0.0/16 br0
|
||||||
```
|
```
|
||||||
Additionally, you also specify the `--gateway` `--ip-range` and `--aux-address` options.
|
|
||||||
|
Additionally, you also specify the `--gateway` `--ip-range` and `--aux-address`
|
||||||
|
options.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
network create --driver=bridge --subnet=172.28.0.0/16 --ip-range=172.28.5.0/24 --gateway=172.28.5.254 br0
|
$ docker network create \
|
||||||
|
--driver=bridge \
|
||||||
|
--subnet=172.28.0.0/16 \
|
||||||
|
--ip-range=172.28.5.0/24 \
|
||||||
|
--gateway=172.28.5.254 \
|
||||||
|
br0
|
||||||
```
|
```
|
||||||
|
|
||||||
If you omit the `--gateway` flag the Engine selects one for you from inside a
|
If you omit the `--gateway` flag the Engine selects one for you from inside a
|
||||||
|
@ -114,20 +121,26 @@ preferred pool. For `overlay` networks and for network driver plugins that
|
||||||
support it you can create multiple subnetworks.
|
support it you can create multiple subnetworks.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker network create -d overlay
|
$ docker network create -d overlay \
|
||||||
--subnet=192.168.0.0/16 --subnet=192.170.0.0/16
|
--subnet=192.168.0.0/16 \
|
||||||
--gateway=192.168.0.100 --gateway=192.170.0.100
|
--subnet=192.170.0.0/16 \
|
||||||
--ip-range=192.168.1.0/24
|
--gateway=192.168.0.100 \
|
||||||
--aux-address a=192.168.1.5 --aux-address b=192.168.1.6
|
--gateway=192.170.0.100 \
|
||||||
--aux-address a=192.170.1.5 --aux-address b=192.170.1.6
|
--ip-range=192.168.1.0/24 \
|
||||||
|
--aux-address a=192.168.1.5 --aux-address b=192.168.1.6 \
|
||||||
|
--aux-address a=192.170.1.5 --aux-address b=192.170.1.6 \
|
||||||
my-multihost-network
|
my-multihost-network
|
||||||
```
|
```
|
||||||
Be sure that your subnetworks do not overlap. If they do, the network create fails and Engine returns an error.
|
|
||||||
|
Be sure that your subnetworks do not overlap. If they do, the network create
|
||||||
|
fails and Engine returns an error.
|
||||||
|
|
||||||
### Network internal mode
|
### Network internal mode
|
||||||
|
|
||||||
By default, when you connect a container to an `overlay` network, Docker also connects a bridge network to it to provide external connectivity.
|
By default, when you connect a container to an `overlay` network, Docker also
|
||||||
If you want to create an externally isolated `overlay` network, you can specify the `--internal` option.
|
connects a bridge network to it to provide external connectivity. If you want
|
||||||
|
to create an externally isolated `overlay` network, you can specify the
|
||||||
|
`--internal` option.
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
**--aux-address**=map[]
|
**--aux-address**=map[]
|
||||||
|
|
Loading…
Reference in New Issue