Interview Prep/Docker/Limits, logging, health checks and restarts

Health check marks a container unhealthy but nothing restarts it.

IntermediateScenarioLimits, logging, health checks and restarts
Answer

Situation read → Plain Docker only labels health; it doesn't act on it.

What I'd do → Use Swarm (restarts unhealthy tasks), Kubernetes probes, or a watcher such as autoheal container, or systemd Restart= plus docker kill hooks. Compose depends_on: condition: service_healthy uses it for ordering only.

Why → The engine records state healthy/unhealthy for orchestrators to use.

Interview tip → This is a classic trick question.

All Docker questions Roadmap: Docker & containers

More on Limits, logging, health checks and restarts