kolla/docker/base/healthcheck_curl
Michal Nasiadka 79851d7929 Build images with healthcheck scripts for core services
blueprint container-health-check

Now docker supports healthcheck directive[0] in Dockerfile,
which is helpful for checking container aliveness.

Base for this patch were healthcheck scripts from tripleo[1].

[0] https://docs.docker.com/engine/reference/builder/#healthcheck
[1] https://github.com/openstack/tripleo-common/tree/master/healthcheck

Change-Id: Ifc32713cd4d6b45c74855c0ebf5bb65784701d44
2019-12-09 12:57:10 +00:00

13 lines
501 B
Bash
Executable File

#!/bin/bash
: ${HEALTHCHECK_CURL_MAX_TIME:=10}
: ${HEALTHCHECK_CURL_USER_AGENT:=curl-healthcheck}
: ${HEALTHCHECK_CURL_WRITE_OUT:='\n%{http_code} %{remote_ip}:%{remote_port} %{time_total} seconds\n'}
: ${HEALTHCHECK_CURL_OUTPUT:='/dev/null'}
export NSS_SDB_USE_CACHE=no
curl -g -k -q -s -S --fail -o "${HEALTHCHECK_CURL_OUTPUT}" \
--max-time "${HEALTHCHECK_CURL_MAX_TIME}" \
--user-agent "${HEALTHCHECK_CURL_USER_AGENT}" \
--write-out "${HEALTHCHECK_CURL_WRITE_OUT}" \
"$@" || exit 1