POST
/containers/prune Connection 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
filters
query
Filters to process on the prune list, encoded as JSON (a map[string][]string).
Available filters:
until=<timestamp>Prune containers created before this timestamp. The<timestamp>can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g.10m,1h30m) computed relative to the daemon machine’s time.label(label=<key>,label=<key>=<value>,label!=<key>, orlabel!=<key>=<value>) Prune containers with (or without, in caselabel!=...is used) the specified labels.
Type:
string
All schema constraints and annotations
{
"type": "string"
}Request and responses
Response
200
No error
application/json
Type:
object
ContainersDeleted
Type:
array
Container IDs that were deleted
Array item
Type:
string
All schema constraints and annotations
{
"type": "string"
}All schema constraints and annotations
{
"description": "Container IDs that were deleted",
"items": {
"type": "string"
},
"type": "array"
}SpaceReclaimed
Type:
integer
Disk space reclaimed in bytes
All schema constraints and annotations
{
"description": "Disk space reclaimed in bytes",
"format": "int64",
"type": "integer"
}All schema constraints and annotations
{
"properties": {
"ContainersDeleted": {
"description": "Container IDs that were deleted",
"items": {
"type": "string"
},
"type": "array"
},
"SpaceReclaimed": {
"description": "Disk space reclaimed in bytes",
"format": "int64",
"type": "integer"
}
},
"title": "ContainerPruneResponse",
"type": "object"
}Response
500
Server error
application/json
Schema:
ErrorResponse
Schema example
{
"message": "Something went wrong."
}Referenced schemas
#/components/schemas/ErrorResponse
Complete operation contract
{
"operationId": "ContainerPrune",
"parameters": [
{
"description": "Filters to process on the prune list, encoded as JSON (a `map[string][]string`).\n\nAvailable filters:\n- `until=\u003ctimestamp\u003e` Prune containers created before this timestamp. The `\u003ctimestamp\u003e` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time.\n- `label` (`label=\u003ckey\u003e`, `label=\u003ckey\u003e=\u003cvalue\u003e`, `label!=\u003ckey\u003e`, or `label!=\u003ckey\u003e=\u003cvalue\u003e`) Prune containers with (or without, in case `label!=...` is used) the specified labels.\n",
"in": "query",
"name": "filters",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"ContainersDeleted": {
"description": "Container IDs that were deleted",
"items": {
"type": "string"
},
"type": "array"
},
"SpaceReclaimed": {
"description": "Disk space reclaimed in bytes",
"format": "int64",
"type": "integer"
}
},
"title": "ContainerPruneResponse",
"type": "object"
}
}
},
"description": "No error"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Server error"
}
},
"summary": "Delete stopped containers",
"tags": [
"Container"
]
}