Free Docker DCA Exam Actual Questions

The questions for DCA were last updated On Dec 19, 2024

Question No. 1

Is this an advantage of multi-stage builds?

Solution: optimizes Images by copying artifacts selectively from previous stages

Show Answer Hide Answer
Correct Answer: A

Multi-stage builds are a feature of Docker that allows you to use multiple FROM statements in your Dockerfile. Each FROM statement creates a new stage of the build, which can use a different base image and run different commands. You can then copy artifacts from one stage to another, leaving behind everything you don't want in the final image. This optimizes the image size and reduces the attack surface by removing unnecessary dependencies and tools. For example, you can use a stage to compile your code, and then copy only the executable file to the final stage, which can use a minimal base image like scratch. This way, you don't need to include the compiler or the source code in the final image.Reference:

Multi-stage builds | Docker Docs

What Are Multi-Stage Docker Builds? - How-To Geek

Multi-stage | Docker Docs