1DOCKER(1)                          OCT 2015                          DOCKER(1)
2
3
4

NAME

6       docker-network-create - create a new network
7
8
9

SYNOPSIS

11       docker network create [--attachable] [--aux-address=map[]]
12       [-d|--driver=DRIVER] [--gateway=[]] [--help] [--internal]
13       [--ip-range=[]] [--ipam-driver=default] [--ipam-opt=map[]] [--ipv6]
14       [--label[=[]]] [-o|--opt=map[]] [--subnet=[]] NETWORK-NAME
15
16
17

DESCRIPTION

19       Creates a new network. The DRIVER accepts bridge or overlay which are
20       the built-in network drivers. If you have installed a third party or
21       your own custom network driver you can specify that DRIVER here also.
22       If you don't specify the --driver option, the command automatically
23       creates a bridge network for you.  When you install Docker Engine it
24       creates a bridge network automatically. This network corresponds to the
25       docker0 bridge that Engine has traditionally relied on. When launch a
26       new container with  docker run it automatically connects to this bridge
27       network. You cannot remove this default bridge network but you can
28       create new ones using the network create command.
29
30
31              $ docker network create -d bridge my-bridge-network
32
33
34
35       Bridge networks are isolated networks on a single Engine installation.
36       If you want to create a network that spans multiple Docker hosts each
37       running an Engine, you must create an overlay network. Unlike bridge
38       networks overlay networks require some pre-existing conditions before
39       you can create one. These conditions are:
40
41
42              · Access to a key-value store. Engine supports Consul, Etcd, and
43                Zookeeper (Distributed store) key-value stores.
44
45              · A cluster of hosts with connectivity to the key-value store.
46
47              · A properly configured Engine daemon on each host in the
48                cluster.
49
50
51
52       The dockerd options that support the overlay network are:
53
54
55              · --cluster-store
56
57              · --cluster-store-opt
58
59              · --cluster-advertise
60
61
62
63       To read more about these options and how to configure them, see "Get
64       started with multi-host network"
65https://docs.docker.com/engine/userguide/networking/get-started-
66       overlay/⟩.
67
68
69       It is also a good idea, though not required, that you install Docker
70       Swarm on to manage the cluster that makes up your network. Swarm
71       provides sophisticated discovery and server management that can assist
72       your implementation.
73
74
75       Once you have prepared the overlay network prerequisites you simply
76       choose a Docker host in the cluster and issue the following to create
77       the network:
78
79
80              $ docker network create -d overlay my-multihost-network
81
82
83
84       Network names must be unique. The Docker daemon attempts to identify
85       naming conflicts but this is not guaranteed. It is the user's
86       responsibility to avoid name conflicts.
87
88

Connect containers

90       When you start a container use the --network flag to connect it to a
91       network.  This adds the busybox container to the mynet network.
92
93
94              $ docker run -itd --network=mynet busybox
95
96
97
98       If you want to add a container to a network after the container is
99       already running use the docker network connect subcommand.
100
101
102       You can connect multiple containers to the same network. Once
103       connected, the containers can communicate using only another
104       container's IP address or name.  For overlay networks or custom plugins
105       that support multi-host connectivity, containers connected to the same
106       multi-host network but launched from different Engines can also
107       communicate in this way.
108
109
110       You can disconnect a container from a network using the docker network
111       disconnect command.
112
113

Specifying advanced options

115       When you create a network, Engine creates a non-overlapping subnetwork
116       for the network by default. This subnetwork is not a subdivision of an
117       existing network.  It is purely for ip-addressing purposes. You can
118       override this default and specify subnetwork values directly using the
119       --subnet option. On a bridge network you can only create a single
120       subnet:
121
122
123              $ docker network create -d bridge --subnet=192.168.0.0/16 br0
124
125
126
127       Additionally, you also specify the --gateway --ip-range and
128       --aux-address options.
129
130
131              $ docker network create \
132                --driver=bridge \
133                --subnet=172.28.0.0/16 \
134                --ip-range=172.28.5.0/24 \
135                --gateway=172.28.5.254 \
136                br0
137
138
139
140       If you omit the --gateway flag the Engine selects one for you from
141       inside a preferred pool. For overlay networks and for network driver
142       plugins that support it you can create multiple subnetworks.
143
144
145              $ docker network create -d overlay \
146                --subnet=192.168.0.0/16 \
147                --subnet=192.170.0.0/16 \
148                --gateway=192.168.0.100 \
149                --gateway=192.170.0.100 \
150                --ip-range=192.168.1.0/24 \
151                --aux-address="my-router=192.168.1.5" --aux-address="my-switch=192.168.1.6" \
152                --aux-address="my-printer=192.170.1.5" --aux-address="my-nas=192.170.1.6" \
153                my-multihost-network
154
155
156
157       Be sure that your subnetworks do not overlap. If they do, the network
158       create fails and Engine returns an error.
159
160
161   Network internal mode
162       By default, when you connect a container to an overlay network, Docker
163       also connects a bridge network to it to provide external connectivity.
164       If you want to create an externally isolated overlay network, you can
165       specify the --internal option.
166
167
168

OPTIONS

170       --attachable
171         Enable manual container attachment
172
173
174       --aux-address=map[]
175         Auxiliary IPv4 or IPv6 addresses used by network driver
176
177
178       -d, --driver=DRIVER
179         Driver to manage the Network bridge or overlay. The default is
180       bridge.
181
182
183       --gateway=[]
184         IPv4 or IPv6 Gateway for the master subnet
185
186
187       --help
188         Print usage
189
190
191       --internal
192         Restrict external access to the network
193
194
195       --ip-range=[]
196         Allocate container ip from a sub-range
197
198
199       --ipam-driver=default
200         IP Address Management Driver
201
202
203       --ipam-opt=map[]
204         Set custom IPAM driver options
205
206
207       --ipv6
208         Enable IPv6 networking
209
210
211       --label=label
212          Set metadata for a network
213
214
215       -o, --opt=map[]
216         Set custom driver options
217
218
219       --subnet=[]
220         Subnet in CIDR format that represents a network segment
221
222
223

HISTORY

225       OCT 2015, created by Mary Anthony ⟨mary@docker.com⟩
226
227
228
229Docker Community              Docker User Manuals                    DOCKER(1)
Impressum