NAME
docker-network-create - Create a network
SYNOPSIS
docker network create [OPTIONS] NETWORK
$ docker network create -d bridge --subnet=192.168.0.0/16 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
$ docker network create -d overlay \
--subnet=192.168.0.0/16 \
--subnet=192.170.0.0/16 \
--gateway=192.168.0.100 \
--gateway=192.170.0.100 \
--ip-range=192.168.1.0/24 \
--aux-address="my-router=192.168.1.5" --aux-address="my-switch=192.168.1.6" \
--aux-address="my-printer=192.170.1.5" --aux-address="my-nas=192.170.1.6" \
my-multihost-network
Network ingress mode
You can create the network which will be used to provide the routing-mesh in the swarm
cluster. You do so by specifying --ingress when creating the network. Only one ingress network
can be created at the time. The network can be removed only if no services depend on it. Any
option available when creating an overlay network is also available when creating the ingress
network, besides the --attachable option.
$ docker network create -d overlay \
--subnet=10.11.0.0/16 \
--ingress \
--opt com.docker.network.mtu=9216 \
--opt encrypted=true \
my-ingress-network
Run services on predefined networks
You can create services on the predefined docker networks bridge and host.
$ docker service create --name my-service \
--network host \
--replicas 2 \
busybox top
OPTIONS
--attachable[=false]
Enable manual container attachment
--aux-address=map[]
Auxiliary IPv4 or IPv6 addresses used by Network driver
--config-from=""
The network from which copying the configuration
--config-only[=false]
Create a configuration only network
-d, --driver="bridge"
Driver to manage the Network
--gateway=[]
IPv4 or IPv6 Gateway for the master subnet
-h, --help[=false]
help for create
--ingress[=false]
Create swarm routing-mesh network
--internal[=false]
Restrict external access to the network
--ip-range=[]
Allocate container ip from a sub-range
--ipam-driver="default"
IP Address Management Driver
--ipam-opt=map[]
Set IPAM driver specific options
--ipv6[=false]
Enable IPv6 networking
--label=
Set metadata on a network
-o, --opt=map[]
Set driver specific options
--scope=""
Control the network's scope
--subnet=[]
Subnet in CIDR format that represents a network segment
SEE ALSO
docker-network(1)