Add initial Docker-in-Docker healthcheck example

This commit is contained in:
Tianon Gravi 2019-08-05 17:10:57 -07:00
parent eb12c27210
commit ccb2dab239
2 changed files with 16 additions and 0 deletions

5
docker/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM docker:dind
COPY docker-healthcheck /usr/local/bin/
HEALTHCHECK CMD ["docker-healthcheck"]

11
docker/docker-healthcheck Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
set -eu
host="$(hostname -i || echo '127.0.0.1')"
if [ -d "$DOCKER_TLS_CERTDIR" ]; then
export DOCKER_HOST="tcp://$host:2376"
else
export DOCKER_HOST="tcp://$host:2375"
fi
docker-entrypoint.sh version > /dev/null || exit 1