v1

latestSwagger 2.02026-07-17107105401.6 KB
Network

Create a network

post/networks/create

Request body

Namestring required

The network's name.

CheckDuplicateboolean

Check for networks with duplicate names. Since Network is primarily keyed based on a random ID and not on the name, and network name is strictly a user-friendly alias to the network which is uniquely identified using ID, there is no guaranteed way to check for duplicates. CheckDuplicate is there to provide a best effort checking of any networks which has the same name but it is not guaranteed to catch all name collisions.

Driverstring

Name of the network driver plugin to use.

Internalboolean

Restrict external access to the network.

Attachableboolean

Globally scoped network is manually attachable by regular containers from workers in swarm mode.

Ingressboolean

Ingress network is the network which provides the routing-mesh in swarm mode.

EnableIPv6boolean

Enable IPv6 on the network.

Optionsobject

Network specific options to be used by the drivers.

Labelsobject

User-defined key/value metadata.

Example request

{
  "Name": "isolated_nw",
  "CheckDuplicate": false,
  "Driver": "bridge",
  "EnableIPv6": true,
  "IPAM": {
    "Driver": "default",
    "Config": [
      {
        "Subnet": "172.20.0.0/16",
        "IPRange": "172.20.10.0/24",
        "Gateway": "172.20.10.11"
      },
      {
        "Subnet": "2001:db8:abcd::/64",
        "Gateway": "2001:db8:abcd::1011"
      }
    ],
    "Options": {
      "foo": "bar"
    }
  },
  "Internal": true,
  "Attachable": false,
  "Ingress": false,
  "Options": {
    "com.docker.network.bridge.default_bridge": "true",
    "com.docker.network.bridge.enable_icc": "true",
    "com.docker.network.bridge.enable_ip_masquerade": "true",
    "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
    "com.docker.network.bridge.name": "docker0",
    "com.docker.network.driver.mtu": "1500"
  },
  "Labels": {
    "com.example.some-label": "some-value",
    "com.example.some-other-label": "some-other-value"
  }
}

Response

No error

Idstring

The ID of the created network.

Warningstring

Example response

{
  "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
  "Warning": ""
}