Skip to main content

Docker in Production

Health Checks and Self-Healing

0:00
LearnStep 1/4

Understanding Health Checks

Container Health Checks

Why Health Checks?

Container running does not mean application is healthy:

text

Health Check in Dockerfile

dockerfile

Health Check Options

  • --interval=30s: Run check every 30 seconds
  • --timeout=3s: Check must complete in 3 seconds
  • --start-period=40s: Grace period before checks start
  • --retries=3: Mark unhealthy after 3 consecutive failures

Health Check Commands

dockerfile

Health Check Script Example

javascript