XK0-006 Automation, Orchestration, and Scripting Practice Question
A system administrator wants to create a bind mount in Docker to share a host directory `/data` with a container at `/mnt/data`. Which of the following docker run options should be used?
⚠ Common exam trap
The trap is confusing the -v shorthand with --mount syntax — candidates pick the --mount option assuming it is 'more modern,' but type=volume is wrong for a host-directory bind mount, which requires type=bind.
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
✓
-v /data:/mnt/data
The -v /data:/mnt/data option creates a bind mount by mapping the host directory /data to the container path /mnt/data, which is exactly the requirement. Docker interprets a host path on the left of the colon as a bind mount, distinguishing it from a named volume. This is the classic syntax for sharing a host directory with a 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.
- ✓
-v /data:/mnt/data
Why this is correct
The `-v /data:/mnt/data` flag creates a bind mount by mapping an absolute host path to a container path, satisfying the requirement to share `/data` at `/mnt/data`. Docker interprets the leading slash as a host filesystem location rather than a named volume, giving the container direct read-write access to that directory.
- ✗
--mount type=volume,source=/data,target=/mnt/data
Why it's wrong here
type=volume creates a named Docker-managed volume, so source=/data is interpreted as a volume name rather than a host path, and the host directory is never bind-mounted. Named volumes suit persistent container-managed data where Docker controls the storage location on the host.
- ✗
-v /data:ro
Why it's wrong here
The ro suffix mounts /data read-only, so the container cannot write to it, and it omits the required target path /mnt/data entirely. Read-only bind mounts suit scenarios where a container only consumes host configuration or static content and must never modify it.
- ✗
-v /mnt/data:/data
Why it's wrong here
Reverses the bind mount's source and target, mounting host /mnt/data into container /data rather than sharing host /data at /mnt/data. The syntax is tempting because -v host:container is the correct bind-mount form; swapping the pair would suit a container needing /data populated from the host's /mnt/data.
Go deeper
Related to this question
About these practice questions
Courseiva writes every XK0-006 question from scratch — 781 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 →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official CompTIA exam blueprint
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.