Courseiva

200-901 Application Deployment and Security Practice Question

A developer wants to ensure that a containerized application restarts automatically if it exits with a non-zero code. The application is run using Docker. Which flag should be used?

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 on-failure

The --restart flag with 'on-failure' restarts the container only if it exits with a non-zero code, which indicates an error.

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 this is correct

    The on-failure restart policy restarts the container only when it exits with a non-zero code, matching the requirement precisely. Unlike always, it avoids restarting after clean exits; unlike unless-stopped, it does not persist across daemon restarts.

  • ✗

    --restart always

    Why it's wrong here

    Always restarts the container on non-zero exit, but it also restarts containers that were deliberately stopped before the daemon restarted, which the scenario does not require. It is tempting because it gives the strongest restart guarantee, suiting long-running services that must never stay down.

  • ✗

    --restart unless-stopped

    Why it's wrong here

    The unless-stopped policy restarts on non-zero exit but halts restarting after a manual stop, so it does not guarantee restart in every case the stem implies. It is tempting because it preserves manual stops across daemon restarts, which suits interactive or maintenance-sensitive workloads.

  • ✗

    --restart no

    Why it's wrong here

    Incorrect. This disables restart.

About these practice questions

This 200-901 question is part of Courseiva's 975-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.