Update docker-healthcheck

This commit is contained in:
5shreya 2024-10-10 12:49:22 +05:30 committed by GitHub
parent 40afbf64d6
commit e50e5a1703
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 4 deletions

View File

@ -1,11 +1,17 @@
#!/bin/sh
set -eu
host="$(hostname -i || echo '127.0.0.1')"
if [ -d "$DOCKER_TLS_CERTDIR" ]; then
host="$(hostname -i 2>/dev/null || { echo 'Failed to get host IP'; exit 1; })"
if [ -n "${DOCKER_TLS_CERTDIR:-}" ] && [ -d "$DOCKER_TLS_CERTDIR" ]; then
export DOCKER_HOST="tcp://$host:2376"
else
elif [ -z "${DOCKER_TLS_CERTDIR:-}" ]; then
export DOCKER_HOST="tcp://$host:2375"
else
echo "TLS cert directory does not exist: $DOCKER_TLS_CERTDIR"
exit 1
fi
docker-entrypoint.sh version > /dev/null || exit 1
docker-entrypoint.sh version > /dev/null || { echo "Failed to get Docker version"; exit 1; }