Linux command
docker-buildx-prune 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Prune all build cache
docker buildx prune
Force prune
docker buildx prune -f
Prune all cache
docker buildx prune --all
Prune cache
docker buildx prune --filter until=[24h]
Prune cache
docker buildx prune --max-used-space [2gb]
Prune cache
docker buildx prune --min-free-space [10gb]
说明
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.
参数
- -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.
FAQ
What is the docker-buildx-prune command used for?
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.
How do I run a basic docker-buildx-prune example?
Run `docker buildx prune` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a, --all do in docker-buildx-prune?
Remove all cache including internal and frontend images.