advancedScenario-Based & System Design Questions

A `docker build` that used to take 30 seconds now takes 8 minutes after a teammate's recent Dockerfile change, with no obvious new heavy dependency added.

Most likely cause: an instruction earlier in the Dockerfile was reordered or modified in a way that broke cache reuse for everything after it — for example, moving a `COPY . .` (full source) above the dependency-installation step, which now invalidates the dependency cache on every single source change. Diagnose by reviewing the diff of the Dockerfile specifically for instruction-order changes, and fix by restoring the least-to-most-frequently-changing ordering.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

A `docker build` that used to take 30 seconds now takes 8 minutes after a teammate's recent Dockerfile change, with no obvious new heavy dependency added.

Next Step

Continue to A service works correctly when run with `docker run` directly but behaves differently (wrong config, missing env vars) when started via `docker compose up`.← Back to all Docker questions