Docker Community Forums

Share and learn in the Docker community.

Healtcheck in running container

(Lukeluha) #1


I know about HEALTHCHECK instruction in Dockerfile and I know about option to add it in docker run command or in docker-compose file.

As I know about healthcheck behaviour, it only checks healthy status of container when the container is starting. If health check was successfull, it marks container as healthy and that’s all.

My question is: is there any option to have these healthchecks in running containers? For example I would like to check if my website returns 200 each 10 seconds, because there can be some trouble in specific instance of container.

Thank you for any advice.

(Think) #2

it is not just checked once, you can specify an interval.

default is 30 seconds. So it would check every 30 seconds your healthcheck command. And after it failed 3 times in a row (cause default retry is 3), it marks the container as unhealthy.