Health checks, the Dockerfile, and not blocking the loop

Two different questions: 'are you alive?' and 'are you ready?'

In production an orchestrator (Kubernetes, ECS, Cloud Run) polls your service constantly with two distinct probes β€” and confusing them causes outages:

  • Liveness β€” is this process alive and responsive? If it fails, the orchestrator restarts the pod. Keep it dependency-free: it must answer 200 the instant the process can, and nothing more.
  • Readiness β€” is this instance ready to receive traffic right now? If it fails, the orchestrator stops routing to it but leaves it running. This one may check dependencies β€” the DB pool is connected, migrations ran β€” because 'not ready yet' is a normal, recoverable state.

Red flag: making liveness check the database. A brief DB blip then fails liveness on every pod at once, the orchestrator restarts them all simultaneously, and you've turned a hiccup into a full outage. Liveness checks the process; readiness checks the dependencies.