HEALTHCHECK
The Dockerfile instruction that tells Docker how to test whether the container is still working.
In more detail
HEALTHCHECK CMD ... runs a command at an interval; a nonzero exit code counts as a failure, and several in a row mark the container unhealthy. Options include --interval, --timeout, --start-period and --retries.
Example
HEALTHCHECK --interval=10s CMD wget -qO- http://localhost:8000/health || exit 1Related terms
- health check — A regular automated test of whether a program or service is working, such as a request to its health endpoint or a command run inside its container.
- exit code — A number a process returns when it finishes: 0 means success, anything else means something went wrong.
Taught in
- Health Checks, Dependencies And Reliable Startup — Docker Architecture & Production Containers
- From Local Containers To Kubernetes — Docker Architecture & Production Containers
- Twelve Lines, Ten Warnings: Dockerfile Instructions And hadolint — Docker Certified Associate (DCA) Exam Prep