Skip to content

Commit

Permalink
try connect to docker-host a few times (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon authored Sep 19, 2022
1 parent 7eb2cc5 commit bcac570
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions legacy/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#!/bin/bash
set -e

if docker -H docker-host.lagoon.svc info &> /dev/null; then
export DOCKER_HOST=docker-host.lagoon.svc
# try connect to docker-host 10 times before giving up
DOCKER_HOST_COUNTER=1
DOCKER_HOST_TIMEOUT=10
until docker -H docker-host.lagoon.svc info &> /dev/null
do
if [ $DOCKER_HOST_COUNTER -lt $DOCKER_HOST_TIMEOUT ]; then
let DOCKER_HOST_COUNTER=DOCKER_HOST_COUNTER+1
echo "docker-host.lagoon.svc not available yet, waiting for 5 secs"
sleep 5
else
echo "could not connect to docker-host.lagoon.svc";
echo "could not connect to docker-host.lagoon.svc"
exit 1
fi
done
export DOCKER_HOST=docker-host.lagoon.svc

mkdir -p ~/.ssh

Expand Down

0 comments on commit bcac570

Please sign in to comment.