Create a container
POST/node/:hostname/container/docker
Create a new container on the target node. Returns a job ID for tracking the asynchronous operation.
Request
Path Parameters
Possible values: non-empty
Target agent hostname, reserved routing value (_any, _all), or label selector (key:value).
- application/json
Body
required
Container creation parameters.
Container image reference (e.g., "nginx:latest").
Optional name for the container.
Command to run in the container.
Environment variables in KEY=VALUE format.
Port mappings in host_port:container_port format.
Volume mounts in host_path:container_path format.
Default value: true
Whether to start the container immediately after creation. Defaults to true.
Responses
- 202
- 400
- 401
- 403
- 500
Container creation accepted.
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
The job ID used to process this request.
results
object[]
required
The hostname of the agent.
Container identifier.
Container name.
Image used by the container.
Current container state.
Container creation timestamp.
Whether the operation modified system state.
Error message if the agent failed.
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"results": [
{
"hostname": "string",
"id": "a1b2c3d4e5f6",
"name": "my-nginx",
"image": "nginx:latest",
"state": "running",
"created": "2024-01-15T10:30:00Z",
"changed": true,
"error": "string"
}
]
}
Invalid request payload.
- application/json
- Schema
- Example (from schema)
Schema
A description of the error that occurred.
Additional details about the error.
The error code.
{
"error": "Failed to retrieve status.",
"details": "Failed due to network timeout.",
"code": 500
}
Unauthorized - API key required
- application/json
- Schema
- Example (from schema)
Schema
A description of the error that occurred.
Additional details about the error.
The error code.
{
"error": "Failed to retrieve status.",
"details": "Failed due to network timeout.",
"code": 500
}
Forbidden - Insufficient permissions
- application/json
- Schema
- Example (from schema)
Schema
A description of the error that occurred.
Additional details about the error.
The error code.
{
"error": "Failed to retrieve status.",
"details": "Failed due to network timeout.",
"code": 500
}
Error creating container.
- application/json
- Schema
- Example (from schema)
Schema
A description of the error that occurred.
Additional details about the error.
The error code.
{
"error": "Failed to retrieve status.",
"details": "Failed due to network timeout.",
"code": 500
}