Skip to content

Create a container

POST
/api/docker/nodes/{nodeId}/containers
curl --request POST \
--url https://gateway.example.com/api/docker/nodes/550e8400-e29b-41d4-a716-446655440000/containers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "folderId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "image": "example", "registryId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "ports": [ { "hostPort": 1, "containerPort": 1, "protocol": "tcp", "hostIp": "0.0.0.0" } ], "volumes": [ { "hostPath": "example", "containerPath": "example", "name": "example", "readOnly": false } ], "env": { "additionalProperty": "example" }, "networks": [ "example" ], "restartPolicy": "no", "runtimeProfile": "default", "stopTimeout": 1, "gpu": { "deviceIds": [ "example" ] }, "labels": { "additionalProperty": "example" }, "command": [ "example" ] }'
nodeId
required
string
>= 1 characters
Example
550e8400-e29b-41d4-a716-446655440000
Idempotency-Key
string
>= 1 characters <= 255 characters

Optional retry key (1-255 printable ASCII characters), bound to your token or session and its current scopes. A retry with the same key and request within 24 hours replays the original response with Idempotency-Replayed: true; a different request under the same key returns 422 IDEMPOTENCY_KEY_REUSED, a retry while the first request still runs returns 409 IDEMPOTENCY_KEY_IN_PROGRESS with Retry-After, and a completed request whose response was not stored returns 409 IDEMPOTENCY_RESPONSE_WITHHELD.

JSON request body

Media typeapplication/json
object
folderId
string | null format: uuid
image
required
string
>= 1 characters
registryId
string format: uuid
name
string
>= 2 characters <= 255 characters /^[a-zA-Z0-9][a-zA-Z0-9_.-]+$/
ports
Array<object>
<= 256 items
object
hostPort
required
integer
<= 65535
containerPort
required
integer
>= 1 <= 65535
protocol
string
default: tcp
Allowed values: tcp udp
hostIp
string format: ip
default: 0.0.0.0
volumes
Array<object>
<= 128 items
object
hostPath
string
>= 1 characters
containerPath
required
string
>= 1 characters
name
string
>= 1 characters
readOnly
boolean
env
object
key
additional properties
string
networks
Array<string>
<= 32 items
restartPolicy
string
default: no
Allowed values: no always unless-stopped on-failure
runtimeProfile
string
default: default
Allowed values: default secure
stopTimeout
integer
<= 300
gpu
object
deviceIds
required
Array<string>
<= 32 items
labels
object
key
additional properties
string
command
Array<string>
<= 256 items

Created

Media typeapplication/json
object
data
required

Resource object. Exact fields depend on the endpoint.

object
id
string
name
string
key
additional properties
Example
{
"data": {
"id": "nginx-prod",
"name": "nginx-prod",
"image": "nginx:1.27",
"state": "running",
"ports": [
"80/tcp"
]
}
}

Bad request

Media typeapplication/json
object
code
required

Error code

string
message
required

Human-readable error message

string
details

Additional error details

Example
{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"path": [
"name"
],
"message": "Required"
}
]
}

Authentication required

Media typeapplication/json
object
code
required

Error code

string
message
required

Human-readable error message

string
details

Additional error details

Example
{
"code": "UNAUTHORIZED",
"message": "Authentication required"
}

Forbidden

Media typeapplication/json
object
code
required

Error code

string
message
required

Human-readable error message

string
details

Additional error details

Example
{
"code": "FORBIDDEN",
"message": "Insufficient permissions"
}

Not found

Media typeapplication/json
object
code
required

Error code

string
message
required

Human-readable error message

string
details

Additional error details

Example
{
"code": "NOT_FOUND",
"message": "Resource not found"
}

Conflict

Media typeapplication/json
object
code
required

Error code

string
message
required

Human-readable error message

string
details

Additional error details

Example
{
"code": "CONFLICT",
"message": "Resource already exists"
}

Unprocessable entity

Media typeapplication/json
object
code
required

Error code

string
message
required

Human-readable error message

string
details

Additional error details

Example
{
"code": "UNPROCESSABLE_ENTITY",
"message": "Request could not be processed"
}

Internal server error

Media typeapplication/json
object
code
required

Error code

string
message
required

Human-readable error message

string
details

Additional error details

Example
{
"code": "INTERNAL_ERROR",
"message": "Internal server error"
}