Create a network Run in API Explorer
Body
Required
Network configuration
-
The network's name.
-
Deprecated: CheckDuplicate is now always enabled.
-
Name of the network driver plugin to use.
Default value is
bridge
. -
Restrict external access to the network.
-
Globally scoped network is manually attachable by regular containers from workers in swarm mode.
-
Ingress network is the network which provides the routing-mesh in swarm mode.
-
Enable IPv6 on the network.
-
Network specific options to be used by the drivers.
-
User-defined key/value metadata.
POST
/networks/create
curl \
--request POST 'http://api.example.com/v1.44/networks/create' \
--header "Content-Type: application/json" \
--data '{"IPAM":{"Config":[{"Subnet":"172.20.0.0/16","Gateway":"172.20.10.11","IPRange":"172.20.10.0/24"},{"Subnet":"2001:db8:abcd::/64","Gateway":"2001:db8:abcd::1011"}],"Driver":"default","Options":{"foo":"bar"}},"Name":"isolated_nw","Driver":"bridge","Labels":{"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"},"Ingress":false,"Options":{"com.docker.network.driver.mtu":"1500","com.docker.network.bridge.name":"docker0","com.docker.network.bridge.enable_icc":"true","com.docker.network.bridge.default_bridge":"true","com.docker.network.bridge.host_binding_ipv4":"0.0.0.0","com.docker.network.bridge.enable_ip_masquerade":"true"},"Internal":true,"Attachable":false,"EnableIPv6":true,"CheckDuplicate":false}'
Request examples
{
"IPAM": {
"Config": [
{
"Subnet": "172.20.0.0/16",
"Gateway": "172.20.10.11",
"IPRange": "172.20.10.0/24"
},
{
"Subnet": "2001:db8:abcd::/64",
"Gateway": "2001:db8:abcd::1011"
}
],
"Driver": "default",
"Options": {
"foo": "bar"
}
},
"Name": "isolated_nw",
"Driver": "bridge",
"Labels": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
},
"Ingress": false,
"Options": {
"com.docker.network.driver.mtu": "1500",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.enable_ip_masquerade": "true"
},
"Internal": true,
"Attachable": false,
"EnableIPv6": true,
"CheckDuplicate": false
}
Response examples (201)
{
"Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
"Warning": ""
}
Response examples (201)
{
"Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
"Warning": ""
}
Response examples (400)
{
"message": "Something went wrong."
}
Response examples (400)
{
"message": "Something went wrong."
}
Response examples (403)
{
"message": "Something went wrong."
}
Response examples (403)
{
"message": "Something went wrong."
}
Response examples (404)
{
"message": "Something went wrong."
}
Response examples (404)
{
"message": "Something went wrong."
}
Response examples (500)
{
"message": "Something went wrong."
}
Response examples (500)
{
"message": "Something went wrong."
}