The answer is SELinux blocking the mount. When a Docker bind mount fails with a permission error, SELinux is the most likely cause because it enforces mandatory access controls that confine container processes to a restricted domain like container_t, and if the host directory lacks the proper SELinux context such as container_file_t, the kernel denies access. On the CompTIA Linux+ XK0-005 exam, this scenario tests your understanding of how SELinux interacts with containerized workloads, often appearing as a trap where candidates mistakenly blame file ownership or permissions instead of SELinux policy. The key fix is adding the `:Z` or `:z` flag to the bind mount in the docker run command, which relabels the host directory to the correct context. Remember the mnemonic "Z for Zone" — `:Z` relabels for a single container, while `:z` shares the context across multiple containers.
XK0-005 Scripting, Containers and Automation Practice Question
This XK0-005 practice question tests your understanding of scripting, containers and automation. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Mar 10 08:15:22 host dockerd[1234]: Time=2025-03-10T08:15:22.123Z Level=error msg="failed to mount local volume: mount :/var/lib/docker/volumes/vol1/_data:/data, flags: 0x1000: permission denied"
Mar 10 08:15:22 host dockerd[1234]: Time=2025-03-10T08:15:22.124Z Level=error msg="error while mounting volume: permission denied"
Refer to the exhibit. A Docker container using a bind mount fails to start with a permission error. What is the most likely cause?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue: "most likely"
Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
Mar 10 08:15:22 host dockerd[1234]: Time=2025-03-10T08:15:22.123Z Level=error msg="failed to mount local volume: mount :/var/lib/docker/volumes/vol1/_data:/data, flags: 0x1000: permission denied"
Mar 10 08:15:22 host dockerd[1234]: Time=2025-03-10T08:15:22.124Z Level=error msg="error while mounting volume: permission denied"
A
The container is running in privileged mode.
Why wrong: Privileged mode would bypass permissions, not cause them.
B
The Docker daemon is not running as root.
Why wrong: Docker daemon always runs as root on Linux; this is unlikely.
C
SELinux is blocking the mount.
SELinux policies can restrict bind mounts, resulting in permission denied errors.
D
The volume path on the host does not exist.
Why wrong: A non-existent path causes a different error, not permission denied.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
SELinux is blocking the mount.
When a Docker container uses a bind mount and fails with a permission error, SELinux is a common cause because it enforces mandatory access controls that can block container processes from accessing host files. By default, SELinux labels container processes with a confined domain (e.g., container_t), and if the bind-mounted host directory lacks the proper SELinux context (e.g., container_file_t), the mount is denied. This is resolved by adding the `:Z` or `:z` flag to the bind mount in the Docker run command to relabel the host directory appropriately.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
The container is running in privileged mode.
Why it's wrong here
Privileged mode would bypass permissions, not cause them.
✗
The Docker daemon is not running as root.
Why it's wrong here
Docker daemon always runs as root on Linux; this is unlikely.
✓
SELinux is blocking the mount.
Why this is correct
SELinux policies can restrict bind mounts, resulting in permission denied errors.
Clue confirmation
The clue word "most likely" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
✗
The volume path on the host does not exist.
Why it's wrong here
A non-existent path causes a different error, not permission denied.
Common exam traps
Common exam trap: answer the scenario, not the keyword
CompTIA often tests the distinction between filesystem permission errors (e.g., user ID mismatch) and SELinux denials, where candidates mistakenly choose 'privileged mode' or 'daemon not root' because they overlook SELinux as the underlying cause in a bind mount context.
Detailed technical explanation
How to think about this question
SELinux uses security contexts (user:role:type:level) to control access; for Docker bind mounts, the host directory must have a type of `container_file_t` (or `svirt_sandbox_file_t` in older versions) for the container to read/write. The `:Z` flag relabels the host path to this type, while `:z` allows sharing among multiple containers. In real-world scenarios, administrators often encounter this when deploying containers on RHEL/CentOS systems with SELinux enforcing, and the error message in `dmesg` or `audit.log` will show an AVC denial.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.
Related glossary terms
Concepts from this question explained
These glossary pages explain the core terms tested in this XK0-005 question in full detail.
Scripting, Containers and Automation — This question tests Scripting, Containers and Automation — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: SELinux is blocking the mount. — When a Docker container uses a bind mount and fails with a permission error, SELinux is a common cause because it enforces mandatory access controls that can block container processes from accessing host files. By default, SELinux labels container processes with a confined domain (e.g., container_t), and if the bind-mounted host directory lacks the proper SELinux context (e.g., container_file_t), the mount is denied. This is resolved by adding the `:Z` or `:z` flag to the bind mount in the Docker run command to relabel the host directory appropriately.
What should I do if I get this XK0-005 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This XK0-005 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-005 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.