200-901 Application Deployment and Security Practice Question
A Docker container needs to be started in detached mode with port mapping from host port 8080 to container port 80. Which command accomplishes 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 myapp
The -d flag runs container in detached mode, -p maps host port to container port.
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 start -d -p 8080:80 myapp
Why it's wrong here
docker start only restarts an existing stopped container and accepts no -p flag, so the port mapping is rejected and no new container is created. It is tempting because docker start -d does legitimately resume a previously created container in the background, which is correct when the container already exists with its ports configured.
- ✓
docker run -d -p 8080:80 myapp
Why this is correct
The `-d` flag detaches the container, running it in the background, while `-p 8080:80` maps host port 8080 to container port 80, satisfying both stem constraints. The syntax `host:container` is critical here; reversing it would publish the wrong port. This single command therefore meets the detached-mode and port-mapping requirements exactly.
- ✗
docker run -it -p 8080:80 myapp
Why it's wrong here
The -it flags allocate an interactive TTY and keep stdin open, attaching the terminal to the container rather than detaching it. Detached mode requires -d, which returns the prompt immediately. Port mapping -p 8080:80 is correct, so only the attachment flags fail the requirement.
- ✗
docker run -d -p 80:8080 myapp
Why it's wrong here
The port pair is reversed: 80:8080 publishes host port 80 to container port 8080, the opposite of the requirement. It is tempting because the syntax is otherwise valid and -d does detach correctly, which is the right choice when the application inside the container genuinely listens on 8080.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 200-901 question from scratch — 975 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 by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 200-901 practice question is part of Courseiva's free Cisco 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 200-901 exam.