One Prompt to Optimize Dockerfile Layer Caching Cut Build Times 72%, From 5.5 to 1.5 Minutes

DanielLockyer · x · 2026-12-04

DanielLockyer shares a practical prompt: "Review my Dockerfile and optimise it for layer caching. Minimise invalidation so small changes don't force full rebuilds."

The quoted build log shows that after adding build-state layer caches in their Docker registry, image build times dropped from 5.5 minutes to 1.5 minutes — a 72% improvement.

Related event: One prompt turns AI loose on Dockerfiles, slashing build times(2 posts)→

Original post →

More from coding & agent

coding & agent channel →