Docker Build Cache
Docker’s build system stores local BuildKit cache records such as intermediate layer snapshots, content-addressed blobs, metadata indexes, and remote source cache entries so repeated builds can reuse previous steps instead of rebuilding everything from scratch. Over time, dangling and long-unused cache accumulates when Dockerfiles change, branches switch, base images update, or multi-stage builds leave behind unreferenced results. Kudu prunes the active local Docker engine’s build cache that has been unused for seven days while retaining roughly 10 GB of cache, without touching containers, volumes, images, custom Buildx builders, or any user data and settings.
Why clean Docker Build Cache?
- Repeated image builds leave behind unreferenced BuildKit layer snapshots and blob records, and the most obvious symptom is Docker consuming tens of gigabytes in its data directory even after old projects are gone
- Cache entries tied to outdated base images or changed Dockerfile steps stop being reusable, so builds still take a long time while disk usage keeps growing from stale intermediate results
- Branch switching and CI-style local testing create many near-duplicate cache records, which shows up as unexpectedly low free space on the host despite only a few current images being in use
- On Docker Desktop, an oversized build cache inside the Linux VM can contribute to the desktop disk image expanding, which users notice as the app taking far more host storage than visible containers and images suggest
- Corrupted or partially useful cache state can cause inconsistent cache hits where some layers rebuild every time, and the user sees noisy 'CACHED' and rebuild behavior that no longer matches recent edits
- Aggressive reuse of old dependency-install layers can mask how much dead cache has accumulated, and the symptom is that routine builds seem normal until the machine suddenly runs low on space during unrelated work
Cache paths Kudu targets
Windows
~ |
macOS
~ |
Linux
~ |
Common questions about Docker Build Cache
Download Kudu and reclaim your disk space.
Available on Windows, macOS, and Linux. No account required, no feature gates, no telemetry without consent. All cleaning targets are open source and community-auditable.