DCA Exam QuestionsBrowse all questions from this exam

DCA Exam - Question 9


Is this an advantage of multi-stage builds?

better caching when building Docker images

Show Answer
Correct Answer:

Discussion

4 comments
Sign in to comment
michele91
Jul 14, 2024

I am not sure that's correct. Documentation seems to hint that multi-stage build help with caching: https://docs.docker.com/build/cache/#use-multi-stage-builds

b_script
Aug 8, 2024

A. Multi-stage builds in Docker offer better caching mechanisms when building Docker images, which is indeed an advantage. This approach allows Docker to cache the results of individual stages in the build process. If a particular stage hasn't changed (for example, the dependencies installation step), Docker can reuse the cached layer from a previous build instead of executing the instructions again. This can significantly reduce build times, especially for complex builds where certain steps (like installing dependencies) do not change often but take a considerable amount of time to complete.

__rajan__Option: B
Jan 7, 2025

Multi-stage builds are not primarily designed to improve caching. Docker's layer caching works the same way in both single-stage and multi-stage builds.

radurocioOption: A
Mar 20, 2025

Caching can help you improve build times and performance because you only build the layer that changed, not the entire project.