Docker add HEALTHCHECK
Enissay opened this issue · comments
Is your feature request related to a problem? Please describe.
Include a HEALTHCHECK for the docker image.
Healthcheck allows a check to be configured in order to determine whether or not containers for a service are “healthy”.
The container may be Up but there is no way for the application inside the container to provide a status (it could be stopped even though the container is running).
So Adding a health check can help monitor & take appropriate steps based on the health status of the application inside the container.
Describe the solution you'd like
Either add a healthcheck inside the docker file OR simply install curl or wget so we can do the health check while runnign in docker compose/swarm.
Example docker compose:
healthcheck:
test: "wget --no-verbose --tries=1 --spider --no-check-certificate http://localhost:8080 || exit 1"
# or
test: "curl -f http://localhost:8080/ || exit 1"
start_period: 5m
interval: 60s
timeout: 30s
retries: 3
Describe alternatives you've considered
N/A
Additional context
Healthcheck official doc: https://docs.docker.com/reference/dockerfile/#healthcheck