LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

docker-buildx-prune

Remove Docker Buildx build cache

TLDR

Prune all build cache with confirmation prompt
$ docker buildx prune
copy
Force prune without confirmation
$ docker buildx prune -f
copy
Prune all cache including internal and frontend images
$ docker buildx prune --all
copy
Prune cache older than 24 hours
$ docker buildx prune --filter until=[24h]
copy
Prune cache and keep at most 2 GB
$ docker buildx prune --max-used-space [2gb]
copy
Prune cache ensuring at least 10 GB free disk space
$ docker buildx prune --min-free-space [10gb]
copy

SYNOPSIS

docker buildx prune [options]

DESCRIPTION

docker buildx prune clears the build cache of the currently selected builder instance. By default it removes only reclaimable cache entries, prompting for confirmation. With --all, it also removes internal and frontend images.The space management flags (--max-used-space, --min-free-space, --reserved-space) allow fine-grained control over disk usage. The --filter flag supports selectors like until, id, type, inuse, mutable, shared, and private, combined with AND logic.

PARAMETERS

-a, --all

Remove all cache including internal and frontend images.
-f, --force
Skip the confirmation prompt.
--filter key=value
Filter cache records to prune (e.g., until=24h, type, inuse, shared).
--max-used-space size
Maximum total disk space for the cache (e.g., 2gb, 512mb).
--min-free-space size
Target amount of free disk space after pruning.
--reserved-space size
Minimum disk space permanently reserved for cache.
--timeout duration
Override default timeout for loading builder status (default: 20s).
--verbose
Show detailed output.

CAVEATS

Without --all, internal images and frontend cache are preserved. Space flags accept human-readable values (e.g., 128mb, 2gb). When multiple space flags are specified, all constraints are honored simultaneously.

SEE ALSO

Copied to clipboard
Kai