Courseiva

CKAD Application Design and Build Practice Question

Which Dockerfile instruction is used to specify the base image for a container image?

⚠ Common exam trap

Many candidates confuse RUN (which executes build-time commands) with FROM (which sets the base image), especially when they see RUN apt-get update and assume it defines the environment, but FROM is the mandatory first instruction that establishes the image foundation.

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

✓

FROM

The FROM instruction initializes a new build stage and sets the base image for subsequent instructions. It must be the first non-comment instruction in a Dockerfile, pulling a specified image from a registry (e.g., Docker Hub) to provide the filesystem and runtime environment for the container.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    COPY

    Why it's wrong here

    COPY is a build-time instruction that transfers files or directories from the build context into the container filesystem at a specified destination path. It is fundamentally a file-copying operation, not an image-selection mechanism, so it has no role in establishing the parent image that a Dockerfile builds upon. Using COPY alone cannot define the runtime environment or OS base for the resulting image.

  • ✓

    FROM

    Why this is correct

    FROM is the only instruction that identifies the base image for a build, either by pulling a tag from a registry (e.g., node:20-alpine) or by referencing a previous build stage by name (e.g., FROM builder AS runtime). This instruction initializes a new build stage and establishes the filesystem, default environment, and runtime libraries that subsequent instructions inherit. Without a valid FROM, Docker will reject the Dockerfile as having no base layer.

  • ✗

    CMD

    Why it's wrong here

    CMD provides the default command to execute when a container is started from the image, supplying runtime arguments or defining an entrypoint's parameters. It is parsed only at container creation time and does not affect the build-time image composition or the choice of parent image. Since CMD operates entirely at runtime, it cannot specify or influence the base image used by the Dockerfile.

  • ✗

    RUN

    Why it's wrong here

    RUN executes arbitrary shell commands during the build process, creating a new layer on top of the current image, typically used for installing software packages or compiling code. While RUN depends on the existing base image's environment, it does not select or change which base image the build starts from. The base image is determined solely by the FROM instruction that precedes any RUN steps.

About these practice questions

One of 826 original CKAD practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.