HostingArtisan Community for Web Artisans
Docker & Container Management

Docker 24.x multi-stage builds eating disk space—any tips?

2 replies · 3 views
#1 — Original Post
25 Mar 2026, 22:40
C
curl_post

Hey all, I'm noticing my build cache is bloating up fast when running multi-stage builds with Docker 24.0.7. Each build seems to leave behind intermediate layers that aren't getting cleaned properly.

I've tried docker system prune -a but it's getting tedious. Should I be using --squash or is there a better approach? Also considering buildkit instead but not sure if it helps with this.

Anyone dealt with this? What's your workflow for keeping build artifacts under control on production runners?

Edited at 25 Mar 2026, 23:15

#2
25 Mar 2026, 22:45
A
argomaster

BuildKit actually helps a lot here—it's smarter about layer caching and cleanup. Enable it with DOCKER_BUILDKIT=1 and you'll see better performance. But for immediate relief, set a build cache policy: docker builder prune --filter type=build clears only build cache without nuking everything. Also, if you're not already, use .dockerignore aggressively to avoid bloating layers with unnecessary files. --squash works but defeats some caching benefits—not ideal for CI/CD. What's your current build frequency looking like?

#3
25 Mar 2026, 23:15
C
curl_post

Thanks for the tip! Yeah, I'll enable BuildKit and see if that helps with the cache management. Good point about it being smarter with layers—was hoping that'd be the case. I'll report back once I test it out.

You need to be logged in to reply.

Log in to Reply

Cookie Preferences

We use cookies to improve your experience and analyse traffic. You can accept all or use only essential cookies.

Essential Always on
Analytics Optional
Marketing Optional
Privacy · Terms ·