Skip to main content

Why does Docker fail to garbage-collect layers sometimes?

Expert Docker
Quick Answer Docker's GC skips layers still referenced by any image manifest or build cache entry. If a manifest or BuildKit cache entry is corrupted or not properly cleaned up, it holds a reference forever รขโ‚ฌโ€ the layer is never collected. Clearing the build cache (docker builder prune) and dangling images usually resolves stuck GC.

Answer

Running or stopped containers still reference layers until removed.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice