Docker Compose file · Services

Add a health check

Mark a service healthy only when a command succeeds.

healthcheck:
  test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
  interval: 10s
  timeout: 3s
  retries: 5
  start_period: 20s

Official Docker Compose file documentation

More services commands

All services commands · Docker Compose file cheatsheet

Was this page helpful?