diff --git a/README.md b/README.md index e2ada63..6aba5dd 100644 --- a/README.md +++ b/README.md @@ -24,12 +24,13 @@ b) Set ENV `AUTOHEAL_CONTAINER_LABEL=all` to watch all running containers. c) Set ENV `AUTOHEAL_CONTAINER_LABEL` to existing label name that has the value `true`. -Note: You must apply `HEALTHCHECK` to your docker images first. See https://docs.docker.com/engine/reference/builder/#/healthcheck for details. +Note: You must apply `HEALTHCHECK` to your docker images first. See https://docs.docker.com/engine/reference/builder/#healthcheck for details. ## ENV Defaults ``` AUTOHEAL_CONTAINER_LABEL=autoheal AUTOHEAL_INTERVAL=5 # check every 5 seconds +AUTOHEAL_START_PERIOD=0 # wait 0 second before first health check DOCKER_SOCK=/var/run/docker.sock ``` diff --git a/docker-entrypoint b/docker-entrypoint index b0921af..bb0b134 100755 --- a/docker-entrypoint +++ b/docker-entrypoint @@ -33,7 +33,9 @@ if [ "$1" = 'autoheal' ] && [ -e ${DOCKER_SOCK} ]; then } fi - echo "Monitoring containers for unhealthy status" + echo "Monitoring containers for unhealthy status in ${AUTOHEAL_START_PERIOD} second(s)" + sleep ${AUTOHEAL_START_PERIOD:=0} + while true; do sleep ${AUTOHEAL_INTERVAL:=5}