container details: limits, sandbox flags and a live stats sample
Container details now carry the image id and the HostConfig resource limits
(CPU cores and shares, memory and swap bytes, pids, device requests) plus sandbox flags
(privileged, read-only rootfs, network mode, restart policy), with null meaning unlimited. A new
GET /api/v1/docker/containers/{name}/stats returns one live sample: CPU percent
of one core, memory working set, processes, block IO and network bytes. Peers
proxy the new route.
Env, labels, command lines and mounts are deliberately excluded from the payload.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
72fccc34f8
commit
0ff3520563
16 files changed
+947
-19
No files matched your search
@@ -197,6 +197,79 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/docker/containers/{name}/stats": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"docker"
|
||||
],
|
||||
"summary": "One live resource sample of a container",
|
||||
"description": "A single Docker stats sample: CPU percent, memory, processes, block IO and network counters. Read once per request, so a caller that wants a time series samples this endpoint itself.",
|
||||
"operationId": "get_container_stats",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"description": "Container name or id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "The sample",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ContainerStats"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid container name",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Missing or unknown bearer token",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Unknown container",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"503": {
|
||||
"description": "Docker socket is not available",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/docker/ps": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -1244,6 +1317,244 @@
|
||||
"unknown"
|
||||
]
|
||||
},
|
||||
"ContainerDevice": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ids",
|
||||
"capabilities"
|
||||
],
|
||||
"properties": {
|
||||
"capabilities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Capabilities such as `gpu`."
|
||||
},
|
||||
"count": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64",
|
||||
"description": "Devices requested; `None` with `ids` means \"as listed\"."
|
||||
},
|
||||
"driver": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"description": "`nvidia`, `cdi`, …"
|
||||
},
|
||||
"ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Device ids as the driver names them, e.g. `nvidia.com/gpu=all`."
|
||||
}
|
||||
}
|
||||
},
|
||||
"ContainerResources": {
|
||||
"type": "object",
|
||||
"description": "Limits and sandbox flags taken from the container's `HostConfig`.\n\nDeliberately narrow: `Env`, `Labels`, `Cmd`, `Args` and mounts are never\ncopied, so nothing here can carry a secret.",
|
||||
"required": [
|
||||
"devices"
|
||||
],
|
||||
"properties": {
|
||||
"cpu_cores": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"format": "double",
|
||||
"description": "CPU limit in cores (`nano_cpus`, else `cpu_quota`/`cpu_period`). `None` is unlimited."
|
||||
},
|
||||
"cpu_shares": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64",
|
||||
"description": "Relative CPU weight; Docker's default is 1024."
|
||||
},
|
||||
"devices": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ids",
|
||||
"capabilities"
|
||||
],
|
||||
"properties": {
|
||||
"capabilities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Capabilities such as `gpu`."
|
||||
},
|
||||
"count": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64",
|
||||
"description": "Devices requested; `None` with `ids` means \"as listed\"."
|
||||
},
|
||||
"driver": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"description": "`nvidia`, `cdi`, …"
|
||||
},
|
||||
"ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Device ids as the driver names them, e.g. `nvidia.com/gpu=all`."
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Device reservations, such as a CDI GPU request."
|
||||
},
|
||||
"memory_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64",
|
||||
"description": "Memory limit in bytes. `None` is unlimited."
|
||||
},
|
||||
"memory_swap_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64",
|
||||
"description": "Memory plus swap limit in bytes."
|
||||
},
|
||||
"network_mode": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"description": "`bridge`, `host`, `none`, or a compose network name."
|
||||
},
|
||||
"pids_limit": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64"
|
||||
},
|
||||
"privileged": {
|
||||
"type": [
|
||||
"boolean",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"read_only_rootfs": {
|
||||
"type": [
|
||||
"boolean",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"restart_policy": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"ContainerStats": {
|
||||
"type": "object",
|
||||
"description": "One live sample from Docker's container stats endpoint.",
|
||||
"required": [
|
||||
"sampled_at"
|
||||
],
|
||||
"properties": {
|
||||
"block_read_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "uint64",
|
||||
"minimum": 0
|
||||
},
|
||||
"block_write_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "uint64",
|
||||
"minimum": 0
|
||||
},
|
||||
"cpu_percent": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"format": "double",
|
||||
"description": "CPU use across all cores in percent (100 = one core fully busy)."
|
||||
},
|
||||
"memory_limit_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "uint64",
|
||||
"minimum": 0
|
||||
},
|
||||
"memory_percent": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"format": "double"
|
||||
},
|
||||
"memory_used_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "uint64",
|
||||
"description": "Working set: usage minus page cache.",
|
||||
"minimum": 0
|
||||
},
|
||||
"network_rx_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "uint64",
|
||||
"minimum": 0
|
||||
},
|
||||
"network_tx_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "uint64",
|
||||
"minimum": 0
|
||||
},
|
||||
"pids": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "uint64",
|
||||
"minimum": 0
|
||||
},
|
||||
"sampled_at": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ContainerStatus": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -1295,6 +1606,13 @@
|
||||
"image": {
|
||||
"type": "string"
|
||||
},
|
||||
"image_id": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"description": "Content address of the image the container runs, e.g. `sha256:…`."
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name without the leading slash."
|
||||
@@ -1305,6 +1623,124 @@
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"resources": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"description": "Configured limits and sandbox flags. Never env, labels or command lines.",
|
||||
"required": [
|
||||
"devices"
|
||||
],
|
||||
"properties": {
|
||||
"cpu_cores": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"format": "double",
|
||||
"description": "CPU limit in cores (`nano_cpus`, else `cpu_quota`/`cpu_period`). `None` is unlimited."
|
||||
},
|
||||
"cpu_shares": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64",
|
||||
"description": "Relative CPU weight; Docker's default is 1024."
|
||||
},
|
||||
"devices": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ids",
|
||||
"capabilities"
|
||||
],
|
||||
"properties": {
|
||||
"capabilities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Capabilities such as `gpu`."
|
||||
},
|
||||
"count": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64",
|
||||
"description": "Devices requested; `None` with `ids` means \"as listed\"."
|
||||
},
|
||||
"driver": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"description": "`nvidia`, `cdi`, …"
|
||||
},
|
||||
"ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Device ids as the driver names them, e.g. `nvidia.com/gpu=all`."
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Device reservations, such as a CDI GPU request."
|
||||
},
|
||||
"memory_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64",
|
||||
"description": "Memory limit in bytes. `None` is unlimited."
|
||||
},
|
||||
"memory_swap_bytes": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64",
|
||||
"description": "Memory plus swap limit in bytes."
|
||||
},
|
||||
"network_mode": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"description": "`bridge`, `host`, `none`, or a compose network name."
|
||||
},
|
||||
"pids_limit": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int64"
|
||||
},
|
||||
"privileged": {
|
||||
"type": [
|
||||
"boolean",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"read_only_rootfs": {
|
||||
"type": [
|
||||
"boolean",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"restart_policy": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"restart_count": {
|
||||
"type": [
|
||||
"integer",
|
||||
|
||||
Reference in new issue
Block a user