Courseiva
Application Design and BuildeasyMultiple ChoiceObjective-mapped

CKAD Application Design and Build Practice Question

Which Dockerfile instruction sets a command that can be overridden when running the container?

⚠ Common exam trap

A common mix-up: candidates confuse ENTRYPOINT and CMD, mistakenly thinking ENTRYPOINT is overridable by default, when in fact CMD is the instruction specifically designed to be overridden by runtime arguments.

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

CMD

The CMD instruction provides default arguments for the container's entrypoint, which can be overridden by supplying command-line arguments when running the container with `docker run`. This makes CMD the correct choice for a command that is intended to be overridden at runtime.

Answer analysis

Option-by-option breakdown

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

  • RUN

    Why it's wrong here

    RUN sets a build-time instruction that executes a command during image creation, not a runtime default that can be overridden by `docker run` arguments. It is tempting because RUN does execute commands, but those commands are baked into the image layers and cannot be replaced at container start. In a scenario requiring software installation or file preparation during the build phase, RUN would be the correct choice.

  • EXPOSE

    Why it's wrong here

    EXPOSE is a metadata instruction that merely documents which ports the container's application is expected to listen on; it does not execute anything at runtime and cannot be overridden by arguments to 'docker run'. In fact, EXPOSE does not even publish those ports to the host—that requires the '-p' flag. Therefore, it is not a command-setting instruction at all, but a static declaration for human readers and legacy linking.

  • ENTRYPOINT

    Why it's wrong here

    ENTRYPOINT defines the fixed, primary process that will always be executed when the container starts. Any arguments supplied after the image name in 'docker run' are not replacing ENTRYPOINT; they are appended as parameters to that entrypoint command. To override ENTRYPOINT, you would need to explicitly use the '--entrypoint' flag. Thus, while ENTRYPOINT does set a command, it is not the one that is overridable by the standard 'docker run <image> <command>' syntax.

  • CMD

    Why this is correct

    CMD is the instruction that sets the default command and parameters for the container. When you run 'docker run <image> <command>', the command you supply entirely overrides the CMD value. This is precisely why CMD is the correct answer: it provides a runtime default that can be easily replaced without any special flags. CMD can also supply default arguments to an ENTRYPOINT if both are defined, but in the absence of ENTRYPOINT, CMD is the executable that runs.

About these practice questions

Courseiva writes every CKAD question from scratch — 160 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 →

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.