# Create a network


[API catalog](/reference/api/) · [Docker Engine overview](/reference/api/engine/version/v1.57/) · [Product manual](https://docs.docker.com/engine/) · [OpenAPI specification](/reference/api/engine/version/v1.57.yaml)

API version: 1.57





`POST /networks/create`



## Connection and access

[API connection and authentication guidance](/reference/api/engine/version/v1.57/#connection)


Server: `/v1.57`

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
null
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request POST \
  --unix-socket "${DOCKER_SOCKET:-/var/run/docker.sock}" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data-binary @request-body \
  'http://localhost/v1.57/networks/create'
```


Prepare request-body using the selected media type and schema.


## Parameters

## Request and responses

### Request  application/json

Network configuration


Schema:

```json
{
  "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

Network created successfully


Schema:

```json
{
  "$ref": "#/components/schemas/NetworkCreateResponse"
}
```










### Response 400 application/json

bad parameter


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 403 application/json

Forbidden operation. This happens when trying to create a network named after a pre-defined network,
or when trying to create an overlay network on a daemon which is not part of a Swarm cluster.



Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 404 application/json

plugin not found


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 500 application/json

Server error


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


## Complete operation contract

```json
{
  "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"
  ]
}
```

## Referenced schemas

- [#/components/schemas/ConfigReference](/reference/api/engine/version/v1.57/schemas/ConfigReference/)

- [#/components/schemas/ErrorResponse](/reference/api/engine/version/v1.57/schemas/ErrorResponse/)

- [#/components/schemas/IPAM](/reference/api/engine/version/v1.57/schemas/IPAM/)

- [#/components/schemas/NetworkCreateResponse](/reference/api/engine/version/v1.57/schemas/NetworkCreateResponse/)




