DELAPARRA
Index
Color
NL
Category: Docker

HEALTHCHECK

Explained by Updated

What is HEALTHCHECK?

HEALTHCHECK: Tells Docker how to test that the container is actually healthy, not just running. Sets the container status to healthy/unhealthy. HEALTHCHECK in a Dockerfile tells Docker how to check whether the application inside a container actually works, not just whether the process is running. A typical check calls a health URL: CMD curl -f http://localhost:8080/health || exit 1.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about HEALTHCHECK

How is HEALTHCHECK used in practice?

Docker runs the check at an interval and marks the container healthy or unhealthy. Compose can wait for a healthy dependency, and orchestration tools can restart or replace unhealthy containers.

What should you keep in mind with HEALTHCHECK?

A good health check is quick and tests what really matters, such as whether the app can answer a request. Avoid checks that depend on external services, or one outage can mark every container unhealthy at once. Kubernetes ignores Dockerfile health checks and uses its own readiness and liveness probes, so define those separately there.

What does an example of HEALTHCHECK look like?

HEALTHCHECK --interval=30s --timeout=3s \ CMD curl -f http://localhost:8080/health || exit 1

At a glance

CategoryDocker
Explained by
Updated

More Docker terms

All terms starting with H

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.