Courseiva

CKAD Application Design and Build Practice Question

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

⚠ Common exam trap

A common trap in the Dockerfile section of the CKAD exam is confusing build-time instructions (FROM, RUN, COPY) with runtime instructions (CMD, ENTRYPOINT). Candidates often select CMD (which sets the default command) instead of FROM, which is required to specify the base image.

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. In Docker, every Dockerfile must start with a FROM (or ARG before FROM) to specify an existing image, such as `FROM ubuntu:22.04` or `FROM alpine:3.18`, from which the new image is built. Without FROM, the build has no foundation and will fail.

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 transfers files from the build context into the image filesystem; it never selects a parent image. It is the correct instruction when adding application source or configuration into a layer, which is why it appears in nearly every Dockerfile after FROM.

  • ✗

    RUN

    Why it's wrong here

    RUN executes commands during the build to install packages or compile code, creating a new layer. It is the right instruction for build-time setup steps, but it cannot declare the parent image the build starts from.

  • ✓

    FROM

    Why this is correct

    FROM declares the base image that subsequent build stages start from, pulling it from a registry or referencing a prior build stage. It must be the first instruction in a stage, establishing the filesystem and environment on which RUN, COPY, and other instructions operate.

  • ✗

    CMD

    Why it's wrong here

    CMD supplies the default command executed when a container starts, and only the last one takes effect. It is correct for defining runtime entry behaviour, not for establishing the base image that subsequent instructions build upon.

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.