EX200 Manage containers Practice Question
A user wants to run a container that will restart automatically unless explicitly stopped by the administrator. Which podman run option should be used?
⚠ Common exam trap
Candidates often choose `--restart=always` thinking it will restart automatically except when manually stopped. However, the key difference is that `--restart=always` will restart the container after a system reboot even if it was manually stopped before the reboot, whereas `--restart=unless-stopped` will not. The question's requirement 'unless explicitly stopped by the administrator' matches `unless-stopped` because it ensures the container does not restart after a manual stop, even across reboots.
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
✓
--restart=unless-stopped
The `--restart=unless-stopped` policy ensures the container restarts automatically whenever it exits, unless the administrator explicitly stops it with `podman stop`. This matches the requirement exactly: the container will keep restarting even after system reboots or crashes, but will not restart if the admin manually stops it. The other policies either do not restart on manual stop (`always`) or only restart on non-zero exit codes (`on-failure`).
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
--restart=on-failure
Why it's wrong here
--restart=on-failure is too narrow because it restarts the container only when the container process exits with a non-zero exit code, indicating an error. If the application exits cleanly with code 0, even briefly or unexpectedly, Docker will not restart it, so this policy does not guarantee an automatic restart after every exit. For a container that must stay up regardless of why it stopped, this policy is insufficient.
- ✗
--restart=always
Why it's wrong here
--restart=always restarts the container under all circumstances, but it also restarts the container even after an administrator has deliberately stopped it with 'docker stop' or 'docker kill' unless the container is explicitly reset with 'docker update --restart=no'. This means the container may come back unexpectedly after a manual stop, which violates the intent of 'unless explicitly stopped'. Therefore it is overly aggressive for the stated requirement.
- ✓
--restart=unless-stopped
Why this is correct
--restart=unless-stopped is correct because it ensures the container is automatically restarted whenever it exits, for any reason, with one crucial exception: if an administrator explicitly issues 'docker stop', the container will not be restarted by the policy until it is manually started again. Docker distinguishes between a container that stopped on its own and one that was intentionally stopped, so this matches the requirement exactly. It also survives daemon restarts and host reboots, making it a robust production choice.
- ✗
--restart=no
Why it's wrong here
--restart=no completely disables the restart policy, so the container runs once and never automatically restarts after it exits, regardless of exit code or the reason for termination. This is the default behavior, and it clearly fails the requirement because there is no automatic restart at all. It is useful only for batch jobs or containers where you want absolute manual control.
Go deeper
Related to this question
About these practice questions
Courseiva writes every EX200 question from scratch — 127 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 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.