एक health check Docker (या एक orchestrator) को बताता है कि कैसे निर्धारित करना है कि एक container का application वास्तव में काम कर रहा है या नहीं, केवल चल रहा है या नहीं। एक container की process चल सकती है जबकि app टूटा हुआ है (hung, अपने database तक नहीं पहुँच सकता) — health checks इसका पता लगाते हैं ताकि platform react कर सके।
एक health check को define करना
# in a Dockerfile
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
# → Docker runs this command periodically; exit 0 = healthy, non-zero = unhealthy
[, , , ]
