From d618b56b40aad7e3695583015fe0f6731d12f413 Mon Sep 17 00:00:00 2001 From: Alessandro Boch Date: Wed, 17 May 2017 12:19:12 -0700 Subject: [PATCH] Docs and manual changes - for service create on node-local networks Signed-off-by: Alessandro Boch --- docs/reference/commandline/network_create.md | 3 ++ man/src/network/create.md | 41 ++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/docs/reference/commandline/network_create.md b/docs/reference/commandline/network_create.md index 4b95c5e50b..099cc1439a 100644 --- a/docs/reference/commandline/network_create.md +++ b/docs/reference/commandline/network_create.md @@ -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 diff --git a/man/src/network/create.md b/man/src/network/create.md index efbf0d5d46..6915cdd354 100644 --- a/man/src/network/create.md +++ b/man/src/network/create.md @@ -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 +``` + + + +