Write health checks that reflect real readiness, gate dependent services on them, and enable automatic recovery from wedged states.

Why "running" is not "working"

Docker knows whether your process is alive; it has no idea whether it works. A container can be "Up 3 hours" while the app inside deadlocked two hours ago, and nothing will restart it because, from the runtime’s perspective, everything is fine. Health checks close that gap: a command Docker runs inside the container on an interval, whose exit code declares healthy or unhealthy. That one bit of truth powers startup ordering, zero-downtime deploys and self-healing.

Anatomy of a good health check

start_period is the underused one: without it, slow-booting apps get marked unhealthy during normal startup