image_prune_builds
Delete Docker's build cache to reclaim disk space after builds. Use when storage is tight; removed cache is rebuilt on demand.
Instructions
Delete the daemon's build cache to reclaim disk space.
Prunes the build cache - a separate Engine resource from the images image_prune removes,
so run both to reclaim everything a build leaves behind. Prefer buildx_prune when the build
ran on a non-default buildx builder (that builder keeps its own cache, invisible here) or when
you need any disk ceiling at all - reserved_space, max_used_space or min_free_space, none of
which the docker-py path can send; this tool needs no CLI plugin and works over any
transport, including a daemon with no local docker binary. Inventory first with system_df
(its BuildCache entry) or buildx_du. Destructive and immediate: later builds must re-run
the steps whose cache was removed. Needs Docker API v1.31+; passing either filters or all
needs v1.39+ and raises InvalidVersion on an older daemon - omit both to prune with the
daemon's own defaults.
Args:
filters: Narrow which cache records to remove, e.g. {"until": "24h"} (a duration or timestamp relative to the
daemon's clock); also accepts id, parent, type, description, inuse, shared, private; omit to
let the daemon prune unused cache
all: Remove all types of build cache, not just the unused records
Returns: dict: {"CachesDeleted": [...], "SpaceReclaimed": }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| all | No | ||
| filters | No |