patternModerate
Docker health checks for container orchestration
Viewed 0 times
HEALTHCHECKhealth endpointreadinessProbelivenessProbedepends_on
Problem
Container orchestrators can't determine if the app inside is actually healthy. Container is running but app has crashed or is unresponsive.
Solution
Add HEALTHCHECK to Dockerfile: HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -f http://localhost:3000/health || exit 1. Health endpoint should check: app responding, DB connected, critical deps reachable. Docker Compose: use depends_on with condition: service_healthy. Kubernetes: use readinessProbe and livenessProbe separately.
Why
A process can be running but deadlocked or unable to serve. Health checks let orchestrators detect this and restart or stop routing traffic.
Revisions (0)
No revisions yet.