Courseiva
Automation, Orchestration, and ScriptingmediumMultiple ChoiceObjective-mapped

XK0-006 Automation, Orchestration, and Scripting Practice Question

A DevOps engineer wants to run a Docker container with a bind mount to make a host directory /data available at /mnt/data inside the container. Which command is correct?

⚠ Common exam trap

A common mix-up: candidates assume the `-v` flag always creates a bind mount, but Docker's `-v` syntax can create either a bind mount or a volume depending on whether the source is an absolute path (bind) or a name (volume), and the `--mount` flag with explicit `type=bind` is the unambiguous, recommended method for bind mounts.

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

docker run --mount type=bind,source=/data,target=/mnt/data ubuntu

The `--mount` flag with `type=bind` explicitly creates a bind mount, mapping the host directory `/data` to the container path `/mnt/data`. This syntax is more explicit and less error-prone than the older `-v` flag, especially when dealing with bind mounts on directories that do not exist yet or when additional mount options are needed.

Answer analysis

Option-by-option breakdown

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

  • docker run -v /data:/mnt/data:bind ubuntu

    Why it's wrong here

    The `-v` flag with `:bind` is syntactically invalid; Docker does not recognize `:bind` as a suffix. The correct syntax for bind mounts with `-v` is just a path pair, e.g., `-v /data:/mnt/data`.

  • docker run -v /data:/mnt/data ubuntu

    Why it's wrong here

    Although the `-v` flag with an absolute source path does create a bind mount, the `--mount` syntax with explicit `type=bind` is the recommended and unambiguous method. The `-v` flag is considered legacy and can be confusing, especially when the source path is not absolute.

  • docker run --mount type=bind,source=/data,target=/mnt/data ubuntu

    Why this is correct

    Correct as explained.

  • docker run --mount type=volume,source=/data,target=/mnt/data ubuntu

    Why it's wrong here

    `type=volume` creates a Docker volume, not a bind mount. A bind mount maps a host directory directly, while a volume is managed by Docker.

About these practice questions

Courseiva writes every XK0-006 question from scratch — 979 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 XK0-006 practice question is part of Courseiva's free CompTIA 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 XK0-006 exam.