docker builder prune: Clear BuildKit Build Cache
Clear BuildKit build cache when it eats the runner disk.
docker builder prune removes BuildKit build cache. This page covers full vs dangling-only cleanup and keep-storage limits for CI.
What it does
docker builder prune deletes cached build layers from BuildKit. By default it removes dangling cache; -a removes all build cache. docker buildx prune is the equivalent for a buildx builder instance.
Common usage
docker builder prune -f
docker builder prune -af # all build cache
docker buildx prune --keep-storage 5GB -fCommon errors in CI
Build cache often dominates "no space left on device" yet is invisible to docker images - check docker system df, then docker builder prune -af. Without -f it prompts and stalls CI. On runners you reuse, prefer --keep-storage to cap cache size rather than wiping it every run, so you keep cache hits while bounding disk.