/networks/create Connection and access
API connection and authentication guidance
/v1.57
No HTTP authentication requirement is declared for this operation. Transport access controls can still apply.
Parameters
No parameters are declared.
Request and responses
Request
application/json
Type:
object
Attachable
Type:
boolean
All schema constraints and annotations
{
"description": "Globally scoped network is manually attachable by regular\ncontainers from workers in swarm mode.\n",
"example": true,
"type": "boolean"
}ConfigFrom
Schema:
ConfigReference
All schema constraints and annotations
{
"$ref": "#/components/schemas/ConfigReference",
"description": "Specifies the source which will provide the configuration for\nthis network. The specified network must be an existing\nconfig-only network; see ConfigOnly.\n"
}ConfigOnly
Type:
boolean
All schema constraints and annotations
{
"default": false,
"description": "Creates a config-only network. Config-only networks are placeholder\nnetworks for network configurations to be used by other networks.\nConfig-only networks cannot be used directly to run containers\nor services.\n",
"example": false,
"type": "boolean"
}Driver
Type:
string
All schema constraints and annotations
{
"default": "bridge",
"description": "Name of the network driver plugin to use.",
"example": "bridge",
"type": "string"
}EnableIPv4
Type:
boolean
All schema constraints and annotations
{
"description": "Enable IPv4 on the network.",
"example": true,
"type": "boolean"
}EnableIPv6
Type:
boolean
All schema constraints and annotations
{
"description": "Enable IPv6 on the network.",
"example": true,
"type": "boolean"
}IPAM
Schema:
IPAM
All schema constraints and annotations
{
"$ref": "#/components/schemas/IPAM",
"description": "Optional custom IP scheme for the network."
}Ingress
Type:
boolean
All schema constraints and annotations
{
"description": "Ingress network is the network which provides the routing-mesh\nin swarm mode.\n",
"example": false,
"type": "boolean"
}Internal
Type:
boolean
All schema constraints and annotations
{
"description": "Restrict external access to the network.",
"type": "boolean"
}Labels
Type:
object
All schema constraints and annotations
{
"additionalProperties": {
"type": "string"
},
"description": "User-defined key/value metadata.",
"example": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
},
"type": "object"
}Name
· required
Type:
string
All schema constraints and annotations
{
"description": "The network's name.",
"example": "my_network",
"type": "string"
}Options
Type:
object
All schema constraints and annotations
{
"additionalProperties": {
"type": "string"
},
"description": "Network specific options to be used by the drivers.",
"example": {
"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"
},
"type": "object"
}Scope
Type:
string
swarm for cluster-wide
or local for machine level).All schema constraints and annotations
{
"description": "The level at which the network exists (e.g. `swarm` for cluster-wide\nor `local` for machine level).\n",
"type": "string"
}All schema constraints and annotations
{
"properties": {
"Attachable": {
"description": "Globally scoped network is manually attachable by regular\ncontainers from workers in swarm mode.\n",
"example": true,
"type": "boolean"
},
"ConfigFrom": {
"$ref": "#/components/schemas/ConfigReference",
"description": "Specifies the source which will provide the configuration for\nthis network. The specified network must be an existing\nconfig-only network; see ConfigOnly.\n"
},
"ConfigOnly": {
"default": false,
"description": "Creates a config-only network. Config-only networks are placeholder\nnetworks for network configurations to be used by other networks.\nConfig-only networks cannot be used directly to run containers\nor services.\n",
"example": false,
"type": "boolean"
},
"Driver": {
"default": "bridge",
"description": "Name of the network driver plugin to use.",
"example": "bridge",
"type": "string"
},
"EnableIPv4": {
"description": "Enable IPv4 on the network.",
"example": true,
"type": "boolean"
},
"EnableIPv6": {
"description": "Enable IPv6 on the network.",
"example": true,
"type": "boolean"
},
"IPAM": {
"$ref": "#/components/schemas/IPAM",
"description": "Optional custom IP scheme for the network."
},
"Ingress": {
"description": "Ingress network is the network which provides the routing-mesh\nin swarm mode.\n",
"example": false,
"type": "boolean"
},
"Internal": {
"description": "Restrict external access to the network.",
"type": "boolean"
},
"Labels": {
"additionalProperties": {
"type": "string"
},
"description": "User-defined key/value metadata.",
"example": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
},
"type": "object"
},
"Name": {
"description": "The network's name.",
"example": "my_network",
"type": "string"
},
"Options": {
"additionalProperties": {
"type": "string"
},
"description": "Network specific options to be used by the drivers.",
"example": {
"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"
},
"type": "object"
},
"Scope": {
"description": "The level at which the network exists (e.g. `swarm` for cluster-wide\nor `local` for machine level).\n",
"type": "string"
}
},
"required": [
"Name"
],
"title": "NetworkCreateRequest",
"type": "object"
}Response
201
application/json
Schema:
NetworkCreateResponse
Response
400
application/json
Schema:
ErrorResponse
Schema example
{
"message": "Something went wrong."
}Response
403
application/json
Schema:
ErrorResponse
Schema example
{
"message": "Something went wrong."
}Response
404
application/json
Schema:
ErrorResponse
Schema example
{
"message": "Something went wrong."
}Response
500
application/json
Schema:
ErrorResponse
Schema example
{
"message": "Something went wrong."
}Referenced schemas
#/components/schemas/ConfigReference
#/components/schemas/ErrorResponse
#/components/schemas/NetworkCreateResponse
Complete operation contract
{
"operationId": "NetworkCreate",
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"Attachable": {
"description": "Globally scoped network is manually attachable by regular\ncontainers from workers in swarm mode.\n",
"example": true,
"type": "boolean"
},
"ConfigFrom": {
"$ref": "#/components/schemas/ConfigReference",
"description": "Specifies the source which will provide the configuration for\nthis network. The specified network must be an existing\nconfig-only network; see ConfigOnly.\n"
},
"ConfigOnly": {
"default": false,
"description": "Creates a config-only network. Config-only networks are placeholder\nnetworks for network configurations to be used by other networks.\nConfig-only networks cannot be used directly to run containers\nor services.\n",
"example": false,
"type": "boolean"
},
"Driver": {
"default": "bridge",
"description": "Name of the network driver plugin to use.",
"example": "bridge",
"type": "string"
},
"EnableIPv4": {
"description": "Enable IPv4 on the network.",
"example": true,
"type": "boolean"
},
"EnableIPv6": {
"description": "Enable IPv6 on the network.",
"example": true,
"type": "boolean"
},
"IPAM": {
"$ref": "#/components/schemas/IPAM",
"description": "Optional custom IP scheme for the network."
},
"Ingress": {
"description": "Ingress network is the network which provides the routing-mesh\nin swarm mode.\n",
"example": false,
"type": "boolean"
},
"Internal": {
"description": "Restrict external access to the network.",
"type": "boolean"
},
"Labels": {
"additionalProperties": {
"type": "string"
},
"description": "User-defined key/value metadata.",
"example": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
},
"type": "object"
},
"Name": {
"description": "The network's name.",
"example": "my_network",
"type": "string"
},
"Options": {
"additionalProperties": {
"type": "string"
},
"description": "Network specific options to be used by the drivers.",
"example": {
"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"
},
"type": "object"
},
"Scope": {
"description": "The level at which the network exists (e.g. `swarm` for cluster-wide\nor `local` for machine level).\n",
"type": "string"
}
},
"required": [
"Name"
],
"title": "NetworkCreateRequest",
"type": "object"
}
}
},
"description": "Network configuration",
"required": true,
"x-codegen-request-body-name": "networkConfig"
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NetworkCreateResponse"
}
}
},
"description": "Network created successfully"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "bad parameter"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Forbidden operation. This happens when trying to create a network named after a pre-defined network,\nor when trying to create an overlay network on a daemon which is not part of a Swarm cluster.\n"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "plugin not found"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Server error"
}
},
"summary": "Create a network",
"tags": [
"Network"
]
}