EX200 Manage containers Practice Question
A system administrator needs to run a container that remains running in the background and executes a web server. Which podman command will correctly run the container detached and map host port 8080 to container port 80?
⚠ Common exam trap
Test-takers frequently confuse the order of the port mapping (`host_port:container_port`) with the reverse, and mistaking `--expose` for a functional port publishing mechanism instead of a documentation-only flag.
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
✓
podman run -d -p 8080:80 nginx
`podman run -d` runs the container in detached mode (background), and `-p 8080:80` maps host port 8080 to container port 80, which is the standard port for the nginx web server. This allows external traffic on host port 8080 to be forwarded to the nginx service inside the 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.
- ✓
podman run -d -p 8080:80 nginx
Why this is correct
The -d flag detaches the container, keeping it running in the background even after your shell exits. The -p flag publishes a port mapping in the form host:container, so -p 8080:80 exposes the container's port 80 (where nginx serves HTTP) on the host's port 8080. This meets the requirement of a persistent, reachable container. Because the mapping order is correct, startup will succeed and traffic to localhost:8080 reaches nginx.
- ✗
podman run -d -p 80:8080 nginx
Why it's wrong here
This option reverses the required host:container port syntax. With -p 80:8080, the host port 80 is forwarded to container port 8080, which is not the port where nginx listens. Nginx's default listening port is 80 inside the container, so the forwarded traffic goes to a closed container port. The intention was to expose the service on host port 8080, but this mapping sends it to the wrong destination.
- ✗
podman run -d --expose 80 nginx
Why it's wrong here
The --expose 80 flag merely declares that the container's port 80 is intended for use; it does not publish that port to the host. Without -p or -P, no port is mapped, making the service unreachable from outside the container's own network namespace. The container may run fine, but a user on the host cannot access nginx via any published port. Therefore, it fails the requirement to expose the container on a specific host port.
- ✗
podman run -d -P 8080:80 nginx
Why it's wrong here
The -P flag (--publish-all) automatically publishes every exposed container port to a random high-numbered host port, and it takes no arguments. The subsequent '8080:80' is not a valid parameter for -P; it would be interpreted as a separate argument, likely causing an error. Even if the command were accepted, the resulting host port would be random, not guaranteed to be 8080. To force a fixed host port, you must use the lowercase -p with an explicit mapping.
Go deeper
Related to this question
About these practice questions
One of 427 original EX200 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 EX200 practice question is part of Courseiva's free Red Hat 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 EX200 exam.