XK0-006 Automation, Orchestration, and Scripting Practice Question
A Linux administrator needs to run a Docker container in detached mode with port mapping from host port 8080 to container port 80, and mount a host directory /data to /app/data inside the container. Which command achieves this?
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 -d -p 8080:80 -v /data:/app/data --name webapp nginx
docker run -d -p 8080:80 -v /data:/app/data --name webapp nginx runs the container detached, maps ports, and mounts a bind volume.
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 -d -p 8080:80 -v /data:/app/data --name webapp nginx
Why this is correct
This command correctly uses -d for detached, -p for port mapping, and -v for volume mount.
- ✗
docker run -it -p 8080:80 -v /data:/app/data --name webapp nginx
Why it's wrong here
-it runs interactively, not detached.
- ✗
docker run -d -P -v /data:/app/data --name webapp nginx
Why it's wrong here
-P maps all exposed ports to random host ports, not specific 8080:80.
- ✗
docker start -d -p 8080:80 -v /data:/app/data webapp
Why it's wrong here
docker start does not support -p or -v; those are run options.
Go deeper
Related to this question
Learn chapter
Linux Fundamentals and History
Key term
Linux
Linux is an open-source operating system that manages computer hardware and software, widely used in servers, desktops, and embedded systems.
Key term
Mount
Mounting is the process of making a file system or storage device accessible to a computer's operating system by attaching it to a specific directory in the existing directory tree.
About these practice questions
One of 979 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
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.