Docs and manual changes
- for service create on node-local networks Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
3950cef941
commit
d618b56b40
2 changed files with 44 additions and 0 deletions
|
@ -37,6 +37,9 @@ Options:
|
|||
-o, --opt value Set driver specific options (default map[])
|
||||
--subnet value Subnet in CIDR format that represents a
|
||||
network segment (default [])
|
||||
--scope value Promote a network to swarm scope (value = [ local | swarm ])
|
||||
--config-only Creates a configuration only network
|
||||
--config-from The name of the network from which copying the configuration
|
||||
```
|
||||
|
||||
## Description
|
||||
|
|
|
@ -134,3 +134,44 @@ $ docker network create -d overlay \
|
|||
--opt encrypted=true \
|
||||
my-ingress-network
|
||||
```
|
||||
|
||||
### Run services on predefined networks
|
||||
|
||||
You can create services on the predefined docker networks `bridge` and `host`.
|
||||
|
||||
```bash
|
||||
$ docker service create --name my-service \
|
||||
--network host \
|
||||
--replicas 2 \
|
||||
busybox top
|
||||
```
|
||||
|
||||
### Swarm networks with local scope drivers
|
||||
|
||||
You can create a swarm network with local scope network drivers. You do so
|
||||
by promoting the network scope to `swarm` during the creation of the network.
|
||||
You will then be able to use this network when creating services.
|
||||
|
||||
```bash
|
||||
$ docker network create -d bridge \
|
||||
--scope swarm \
|
||||
--attachable \
|
||||
swarm-network
|
||||
```
|
||||
|
||||
For network drivers which provide connectivity across hosts (ex. macvlan), if
|
||||
node specific configurations are needed in order to plumb the network on each
|
||||
host, you will supply that configuration via a configuration only network.
|
||||
When you create the swarm scoped network, you will then specify the name of the
|
||||
network which contains the configuration.
|
||||
|
||||
|
||||
```bash
|
||||
node1$ docker network create --config-only --subnet 192.168.100.0/24 --gateway 192.168.100.115 mv-config
|
||||
node2$ docker network create --config-only --subnet 192.168.200.0/24 --gateway 192.168.200.202 mv-config
|
||||
node1$ docker network create -d macvlan --scope swarm --config-from mv-config --attachable swarm-network
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue