Interview Prep/Docker/Build failures and cache problems

Layer cache is never used though nothing changed (every step rebuilds).

AdvancedTroubleshootingBuild failures and cache problems
Answer

Likely causes → Fresh CI runner, --no-cache, ARG with changing value (e.g. BUILD_DATE) declared early, COPY . . including changing files, or builder pruned.

Diagnose → docker buildx build --progress=plain .; diff docker history of two builds.

Fix → Move volatile ARGs to the end, ignore generated files, add registry cache.

Prevent → Treat cache hit rate as a metric.

All Docker questions Roadmap: Docker & containers

More on Build failures and cache problems