Courseiva
Automation, Orchestration, and ScriptingmediumMultiple ChoiceObjective-mapped

XK0-006 Automation, Orchestration, and Scripting Practice Question

A Podman user wants to run a container that automatically removes itself after it stops, runs in detached mode, and maps host port 80 to container port 8080. Which command is correct?

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 --rm -d -p 80:8080 nginx

The correct command is podman run --rm -d -p 80:8080 nginx. Option B correctly uses --rm to automatically remove the container after it stops, -d for detached mode, and -p 80:8080 to map host port 80 to container port 8080. Option A uses an invalid flag -rm and maps ports incorrectly (8080:80). Option C uses an invalid flag --remove. Option D maps ports incorrectly (8080:80).

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 -rm -d -p 8080:80 nginx

    Why it's wrong here

    Incorrect. This command maps host port 8080 to container port 80 (reverse of required) and uses `-rm` instead of `--rm`.

  • podman run --rm -d -p 80:8080 nginx

    Why this is correct

    Correct. Uses `--rm`, `-d`, and correct port mapping `80:8080`.

  • podman run --remove -d -p 80:8080 nginx

    Why it's wrong here

    Incorrect. The flag `--remove` is invalid; the correct flag is `--rm`.

  • podman run --rm -d -p 8080:80 nginx

    Why it's wrong here

    Incorrect in this single-answer question. While the command is identical to B, it is not accepted as a second correct answer.

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 →

How Courseiva writes practice questions · Editorial policy

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.