What does Docker do when a container is unhealthy?
IntermediateProductionResource Limits, Health & Reliability
Answer
On plain Docker, nothing: it only marks the status and emits a health_status event. A restart policy does not react to health. Swarm replaces unhealthy tasks. Kubernetes ignores Docker HEALTHCHECK and uses its own probes. To auto-heal on a single host use a watcher like willfarrell/autoheal or systemd with Restart=.
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