Courseiva

CKAD Application Design and Build Practice Question

Which Dockerfile instruction is used to define a mount point for a volume?

⚠ Common exam trap

Many candidates confuse the Dockerfile VOLUME instruction with the `docker run -v` or `--mount` runtime flags, or mistakenly think EXPOSE or ADD can define volumes, when only VOLUME in the Dockerfile declares the mount point.

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

✓

VOLUME

The VOLUME instruction in a Dockerfile creates a mount point at the specified path within the container, marking it as holding externally mounted volumes from the host or other containers. This is the correct way to declare a volume in the Dockerfile, ensuring data persistence and enabling volume sharing between containers.

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

    Why it's wrong here

    ADD is a Dockerfile instruction that copies files and directories from the build context into the image filesystem, and it can also fetch remote URLs and automatically extract tar archives. However, it simply places content at a destination path; it does not declare that path as a mount point for a volume. The Dockerfile instruction used specifically to define a mount point is VOLUME, not ADD, so ADD is incorrect for this purpose.

  • ✓

    VOLUME

    Why this is correct

    VOLUME is the correct Dockerfile instruction because it explicitly creates a mount point and marks it as a location for external storage volumes. When a container is run, Docker automatically creates an anonymous volume at that path unless a named volume or bind mount is supplied via the run command or compose file. This instruction is essential for defining persistent data locations, as it tells Docker that the specified directory should be preserved independently of the container's writable layer and can be shared between containers.

  • ✗

    EXPOSE

    Why it's wrong here

    EXPOSE is a Dockerfile instruction that documents which network ports the container listens on at runtime; it is purely informational and does not actually publish or map any ports unless combined with -P or -p at runtime. It has no relationship to filesystem mount points or volume management, as it operates on the network stack rather than the storage layer. Since the question asks about defining a mount point, EXPOSE is unrelated and therefore incorrect.

  • ✗

    MOUNT

    Why it's wrong here

    There is no MOUNT instruction in the Dockerfile specification, so it cannot be used to define a mount point. While container runtimes and orchestration tools like Docker CLI or Kubernetes use --mount or volume mounts to attach storage, the only Dockerfile instruction that explicitly defines a mount point is VOLUME. The absence of a MOUNT instruction makes this option invalid and incorrect for the 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 →

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.