Courseiva
mediumMultiple ChoiceObjective-mapped

200-901 Practice Question: A developer needs to run a temporary container…

A developer needs to run a temporary container that executes a command and then exits. Which Docker command should be used?

⚠ Common exam trap

Cisco often tests the distinction between `docker run` (creates and starts a new container) and `docker exec` (attaches to an existing running container), leading candidates to mistakenly choose `docker exec` for running a one-time command.

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 --rm

The `docker run --rm` command creates a container, runs the specified command, and automatically removes the container filesystem after it exits. This is the correct approach for a temporary, disposable container that should not persist after execution. The `--rm` flag ensures cleanup without manual intervention.

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 exec

    Why it's wrong here

    docker exec runs a command in a running container, not for initial execution.

  • docker run -d

    Why it's wrong here

    This runs a container in detached mode, but doesn't remove it automatically.

  • docker start

    Why it's wrong here

    docker start starts an existing stopped container, not for one-time commands.

  • docker run --rm

    Why this is correct

    This runs a container and removes it after it exits.

About these practice questions

This 200-901 question is part of Courseiva's 989-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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 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.