check docker status in every seconds instead of sleep
This commit is contained in:
15
install.sh
15
install.sh
@@ -197,8 +197,19 @@ check_running() {
|
||||
DOCKERD_STATUS=$($SUDO_CMD systemctl status docker | grep running | wc -l)
|
||||
if [ "$DOCKERD_STATUS" == "0" ]; then
|
||||
$SUDO_CMD systemctl start docker
|
||||
sleep 5;
|
||||
DOCKERD_STATUS=$($SUDO_CMD systemctl status docker | grep running | wc -l)
|
||||
|
||||
# wait for docker start, check in every seconds, run for max. 60 sec
|
||||
WAIT_COUNT=0;
|
||||
while [ "$DOCKERD_STATUS" == "0" ]; do
|
||||
sleep 1;
|
||||
WAIT_COUNT=$((WAIT_COUNT+1))
|
||||
DOCKERD_STATUS=$($SUDO_CMD systemctl status docker | grep running | wc -l)
|
||||
|
||||
if [ $WAIT_COUNT -gt 60 ]; then
|
||||
break; # docker hasn't started in 60 seconds
|
||||
fi;
|
||||
done;
|
||||
|
||||
if [ "$DOCKERD_STATUS" == "0" ]; then
|
||||
echo "Docker daemon not running, please check and execute again the install script";
|
||||
exit;
|
||||
|
Reference in New Issue
Block a user