CKAD Application Design and Build Practice Question
You have a multi-stage Dockerfile. You want to copy artifacts from the builder stage to the final stage. Which instruction should you use in the final stage?
⚠ Common exam trap
CKAD often tests the misconception that ADD or RUN can be used with --from to copy from another stage, but only COPY supports the --from flag for multi-stage artifact transfer.
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 the --from flag is specifically designed for multi-stage builds to copy files from a previous build stage (or an external image) into the current stage. It only copies local files or directories from the specified stage, making it the correct and efficient way to transfer artifacts like compiled binaries. This avoids including unnecessary build dependencies in the final image.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
ADD --from=builder /app/artifact /app/
Why it's wrong here
ADD --from=builder /app/artifact /app/ is technically supported by recent Docker engines (BuildKit), but it is not the right choice for simply copying a build artifact. ADD automatically extracts local tar archives and can fetch remote URLs, which introduces hidden behavior that can corrupt or alter the artifact being copied. Docker's official guidance reserves ADD for special-cased sources; for a plain multi-stage artifact transfer, COPY is the explicit, predictable instruction.
- ✗
RUN --from=builder cp /app/artifact /app/
Why it's wrong here
RUN --from=builder cp /app/artifact /app/ is invalid because RUN does not accept a --from flag in multi-stage builds; --from is a source selector only for COPY and ADD. RUN executes a command in a temporary container from the current stage's filesystem, so any cp would only see the current stage's contents, not the builder stage. To bring a file over from a previous stage, you must use COPY --from=builder ... rather than trying to perform a shell-level copy.
- ✓
COPY --from=builder /app/artifact /app/
Why this is correct
COPY --from=builder /app/artifact /app/ is the standard multi-stage mechanism: it tells the current build stage to take the file or directory at /app/artifact from the stage named builder and place it at /app in the new image layer. This instruction is explicit about the source stage, avoids ADD's archive-extraction side effects, and lets you keep build-only tools out of the final runtime image. The artifact is copied directly from the builder stage's filesystem into the next stage's filesystem.
- ✗
CMD --from=builder /app/artifact /app/
Why it's wrong here
CMD --from=builder /app/artifact /app/ fundamentally misuses the CMD instruction because CMD defines the default executable and arguments for the container at runtime; it has no build-time copy behavior and no --from flag. If this appeared in a Dockerfile, CMD would try to interpret the first token as a command, not as a source file, and nothing would be copied during the build. File transfer between stages is a build-time operation handled exclusively by COPY/ADD, so CMD has no role in multi-stage artifact retrieval.
Go deeper
Related to this question
About these practice questions
This CKAD question is part of Courseiva's 826-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official CNCF exam blueprint
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.