Network

Create a network

Changed on
post/networks/create

Request

  • Base URL
    /v1.44 (relative, and the document was published on a file host, not at the API’s origin)
  • URL
    /v1.44/networks/create
  • Auth
    none declared

Request body

Namestring required

The network's name.

CheckDuplicateboolean

Deprecated: CheckDuplicate is now always enabled.

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": ""
}

Changes