Interview Prep/Docker/Dockerfile Instructions & Builds

What is the ordering mistake that breaks caching most often?

BeginnerConceptDockerfile Instructions & Builds
Answer

Doing COPY . . before installing dependencies, so any source edit reinstalls everything. Also putting volatile ARGs (like BUILD_DATE or git SHA) near the top invalidates all subsequent layers. Put volatile values as late as possible.

All Docker questions Roadmap: Docker & containers

More on Dockerfile Instructions & Builds