diff --git a/README.md b/README.md index 9d40d7d..9638d92 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ 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 can also exclude a container (eg. if using `AUTOHEAL_CONTAINER_LABEL=all`) by setting the label `autoheal=false`. + Note: You must apply `HEALTHCHECK` to your docker images first. See https://docs.docker.com/engine/reference/builder/#healthcheck for details. Use `tcp://` for unencrypted tcp and `tcps://` for TLS enabled connection. See https://docs.docker.com/engine/security/https/ for how to configure TCP with mTLS. diff --git a/docker-entrypoint b/docker-entrypoint index 88c125d..e208b11 100755 --- a/docker-entrypoint +++ b/docker-entrypoint @@ -123,7 +123,7 @@ then do STOP_TIMEOUT=".Labels[\"autoheal.stop.timeout\"] // $AUTOHEAL_DEFAULT_STOP_TIMEOUT" get_container_info | \ - jq -r "foreach .[] as \$CONTAINER([];[]; \$CONTAINER | .Id, .Names[0], .State, ${STOP_TIMEOUT})" | \ + jq -r ".[] | select(.Labels[\"autoheal\"] != \"False\") | foreach . as \$CONTAINER([];[]; \$CONTAINER | .Id, .Names[0], .State, ${STOP_TIMEOUT})" | \ while read -r CONTAINER_ID && read -r CONTAINER_NAME && read -r CONTAINER_STATE && read -r TIMEOUT do # shellcheck disable=2039