Skip to content

Commit bd64caa

Browse files
committed
Docker: limited the waiting time for control socket creation.
While at it, fixed a typo.
1 parent c056ad1 commit bd64caa

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/docker/docker-entrypoint.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ if [ "$1" = "unitd" ] || [ "$1" = "unitd-debug" ]; then
2929
echo "$0: /docker-entrypoint.d/ is not empty, launching Unit daemon to perform initial configuration..."
3030
/usr/sbin/$1 --control unix:/var/run/control.unit.sock
3131

32-
while [ ! -S /var/run/control.unit.sock ]; do echo "$0: Waiting for control socket to be created..."; /bin/sleep 0.1; done
32+
for i in $(/usr/bin/seq $WAITLOOPS); do
33+
if [ ! -S /var/run/control.unit.sock ]; then
34+
echo "$0: Waiting for control socket to be created..."
35+
/bin/sleep $SLEEPSEC
36+
else
37+
break
38+
fi
39+
done
3340
# even when the control socket exists, it does not mean unit has finished initialisation
3441
# this curl call will get a reply once unit is fully launched
3542
/usr/bin/curl -s -X GET --unix-socket /var/run/control.unit.sock http://localhost/
@@ -62,7 +69,7 @@ if [ "$1" = "unitd" ] || [ "$1" = "unitd-debug" ]; then
6269

6370
for i in $(/usr/bin/seq $WAITLOOPS); do
6471
if [ -S /var/run/control.unit.sock ]; then
65-
echo "$0 Waiting for control socket to be removed..."
72+
echo "$0: Waiting for control socket to be removed..."
6673
/bin/sleep $SLEEPSEC
6774
else
6875
break

0 commit comments

Comments
 (0)