Diagram
A decision tree that starts with whether a container must stay running, then branches on failure retry needs to choose the Always, OnFailure, or Never restart policy.
Security and Restart Behavior
You control what happens when a container stops by setting a restart policy. The Always policy keeps the container running and restarts it if it ever stops, which works for web services that must stay available. The OnFailure policy restarts the container only when it exits with an error, useful for batch jobs that should retry on failure. The Never policy leaves the container stopped after it finishes, which fits one-time tasks. Choosing the right policy prevents unnecessary restarts and ensures your application behaves as expected.
Domain 6 of 7
2 practice questions
Practice this DomainLast updated