v1

latestOpenAPI 3.0.02026-07-1410578280.2 KB
Network

Create a network

post/networks/create

Request body

Attachableboolean

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

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.

EnableIPv6boolean

Enable IPv6 on the network.

Ingressboolean

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

Internalboolean

Restrict external access to the network.

Labelsobject

User-defined key/value metadata.

Namestring required

The network's name.

Optionsobject

Network specific options to be used by the drivers.

Example request

{
  "Attachable": false,
  "CheckDuplicate": false,
  "Driver": "bridge",
  "EnableIPv6": true,
  "IPAM": {
    "Config": [
      {
        "Gateway": "172.20.10.11",
        "IPRange": "172.20.10.0/24",
        "Subnet": "172.20.0.0/16"
      },
      {
        "Gateway": "2001:db8:abcd::1011",
        "Subnet": "2001:db8:abcd::/64"
      }
    ],
    "Driver": "default",
    "Options": {
      "foo": "bar"
    }
  },
  "Ingress": false,
  "Internal": true,
  "Labels": {
    "com.example.some-label": "some-value",
    "com.example.some-other-label": "some-other-value"
  },
  "Name": "isolated_nw",
  "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"
  }
}

Response

No error

Idstring

The ID of the created network.

Warningstring

Example response

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