POST
/networks/{id}/connect The network must be either a local-scoped network or a swarm-scoped network with the
attachable option set. A network cannot be re-attached to a running containerConnection 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
id
path
Required
Network ID or name
Type:
string
All schema constraints and annotations
{
"type": "string"
}Request and responses
Request
application/json
Schema:
NetworkConnectRequest
Response
200
No error
application/json
Response
200
No error
text/plain
Response
400
bad parameter
application/json
Schema:
ErrorResponse
Schema example
{
"message": "Something went wrong."
}Response
403
Operation forbidden
application/json
Schema:
ErrorResponse
Schema example
{
"message": "Something went wrong."
}Response
404
Network or container not found
application/json
Schema:
ErrorResponse
Schema example
{
"message": "Something went wrong."
}Response
500
Server error
application/json
Schema:
ErrorResponse
Schema example
{
"message": "Something went wrong."
}Referenced schemas
#/components/schemas/ErrorResponse
#/components/schemas/NetworkConnectRequest
Complete operation contract
{
"description": "The network must be either a local-scoped network or a swarm-scoped network with the `attachable` option set. A network cannot be re-attached to a running container",
"operationId": "NetworkConnect",
"parameters": [
{
"description": "Network ID or name",
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NetworkConnectRequest"
}
}
},
"required": true,
"x-codegen-request-body-name": "container"
},
"responses": {
"200": {
"content": {
"application/json": {},
"text/plain": {}
},
"description": "No error"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "bad parameter"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Operation forbidden"
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Network or container not found"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Server error"
}
},
"summary": "Connect a container to a network",
"tags": [
"Network"
]
}