A running container can appear healthy while its application returns errors. HEALTHCHECK adds an in-container command that Docker runs at intervals and uses its status code to mark the container healthy or unhealthy. section 8.1
Check an HTTP health endpoint
Add `HEALTHCHECK CMD curl --fail http://localhost:8080/health` to a Dockerfile. The endpoint returns success while the API works and failure after the application breaks; Docker then records the unhealthy state while leaving the container running.
