Create a network Run in API Explorer
Body
Required
Network configuration
-
The network's name.
-
Name of the network driver plugin to use.
Default value is
bridge
. -
The level at which the network exists (e.g.
swarm
for cluster-wide orlocal
for machine level). -
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.
-
Creates a config-only network. Config-only networks are placeholder networks for network configurations to be used by other networks. Config-only networks cannot be used directly to run containers or services.
Default value is
false
. -
The config-only network source to provide the configuration for this network.
-
Enable IPv4 on the network.
-
Enable IPv6 on the network.
-
Network specific options to be used by the drivers.
-
User-defined key/value metadata.
curl \
--request POST 'http://api.example.com/v1.49/networks/create' \
--header "Content-Type: application/json" \
--data '{"Name":"my_network","Driver":"bridge","Scope":"string","Internal":true,"Attachable":true,"Ingress":false,"ConfigOnly":false,"ConfigFrom":{"Network":"config_only_network_01"},"IPAM":{"Driver":"default","Config":[{"Subnet":"172.20.0.0/16","IPRange":"172.20.10.0/24","Gateway":"172.20.10.11","AuxiliaryAddresses":{"additionalProperty1":"string","additionalProperty2":"string"}}],"Options":{"foo":"bar"}},"EnableIPv4":true,"EnableIPv6":true,"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"},"Labels":{"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"}}'
{
"Name": "my_network",
"Driver": "bridge",
"Scope": "string",
"Internal": true,
"Attachable": true,
"Ingress": false,
"ConfigOnly": false,
"ConfigFrom": {
"Network": "config_only_network_01"
},
"IPAM": {
"Driver": "default",
"Config": [
{
"Subnet": "172.20.0.0/16",
"IPRange": "172.20.10.0/24",
"Gateway": "172.20.10.11",
"AuxiliaryAddresses": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
}
],
"Options": {
"foo": "bar"
}
},
"EnableIPv4": true,
"EnableIPv6": true,
"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"
},
"Labels": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
}
}
{
"Id": "b5c4fc71e8022147cd25de22b22173de4e3b170134117172eb595cb91b4e7e5d",
"Warning": "string"
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}