CKAD Application Design and Build Practice Question
You have a multi-stage Dockerfile with two stages: 'builder' and 'runtime'. You want to copy artifacts from the builder stage to the runtime stage. Which Dockerfile instruction achieves this?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
COPY --from=builder /app/artifact /app/
The COPY instruction with --from=stage-name copies files from a previous build stage.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
EXPORT builder /app/artifact /app/
Why it's wrong here
EXPORT is not a valid Dockerfile instruction. The Dockerfile language has a fixed set of directives like FROM, RUN, COPY, and CMD; EXPORT does not exist, so the build will fail immediately. The only way to carry an artifact between stages in a multi-stage build is COPY --from, which explicitly references the source stage. Therefore, EXPORT builder /app/artifact /app/ is syntactically invalid and cannot accomplish the task.
- ✗
ADD --from=builder /app/artifact /app/
Why it's wrong here
ADD --from=builder is invalid because the ADD instruction in Docker does not support the --from flag. The --from flag is exclusive to COPY and is what enables copying from a previous stage in a multi-stage build. ADD is designed to add files from the build context or from a URL, and it has its own behaviors like automatic archive extraction, but it cannot reference another stage. Thus, this command would be rejected by the Docker builder.
- ✗
COPY ../builder/artifact /app/
Why it's wrong here
COPY ../builder/artifact /app/ attempts to reference a path outside the build context, which Docker forbids for security reasons. The build context is the directory sent to the Docker daemon as the root for all file operations, and COPY can only access files within it. Moreover, even if the path were inside the context, this form of COPY reads from the build context, not from the builder stage; to copy from a stage you must use COPY --from=builder. As a result, this fails both because of the out-of-bounds path and the missing --from flag.
- ✓
COPY --from=builder /app/artifact /app/
Why this is correct
This is the correct way to copy an artifact from a previous build stage. The --from=builder flag tells Docker to treat the source path /app/artifact as being in the filesystem of the stage named builder, rather than in the build context. This copies the compiled artifact into the current stage's /app/ directory, enabling a clean separation between the build environment and the final runtime image. The COPY instruction is specifically designed to support this cross-stage file transfer.
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKAD question from scratch — 826 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKAD practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKAD exam.