advancedTop 100 Interview Questions
Why is instruction order important for build cache efficiency?
Docker's build cache invalidates a layer (and every layer after it) once any earlier instruction's inputs change. Placing rarely-changing instructions (installing dependencies) before frequently-changing ones (copying source code) means most builds only need to re-execute the last few steps rather than the whole build.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response