What are the Docker restart policies?
BeginnerProductionResource Limits, Health & Reliability
Answer
no (default), on-failure[:max] (non-zero exit only), always (even after manual stop once daemon restarts), unless-stopped (like always but respects manual stop). Docker applies exponential backoff starting at 100ms, capped at 1 minute, and resets after 10 seconds of running.
docker run -d --restart unless-stopped app
docker update --restart on-failure:5 app
More on Resource Limits, Health & Reliability
How do you set memory and CPU limits, and what happens when they are exceeded?BeginnerWhat is the difference between `--cpus`, `--cpu-shares` and `--cpuset-cpus`?BeginnerWhat does `--memory-reservation` do?AdvancedHow do you diagnose an OOM-killed container?IntermediateWhy do JVM and Node services in containers need explicit memory flags?IntermediateWhat is CPU throttling, and how do you detect it?Advanced