mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
make docker-checker more robust
This commit is contained in:
parent
56de2d11a0
commit
736c02c7a0
@ -20,11 +20,22 @@
|
|||||||
|
|
||||||
/etc/init.d/docker stop
|
/etc/init.d/docker stop
|
||||||
# Make sure docker gracefully terminated before start again
|
# Make sure docker gracefully terminated before start again
|
||||||
|
starttime=`date +%s`
|
||||||
while pidof docker > /dev/null; do
|
while pidof docker > /dev/null; do
|
||||||
|
currenttime=`date +%s`
|
||||||
|
((elapsedtime = currenttime - starttime))
|
||||||
|
# after 60 seconds, forcefully terminate docker process
|
||||||
|
if test $elapsedtime -gt 60; then
|
||||||
|
echo "attempting to kill docker process with sigkill signal"
|
||||||
|
kill -9 `pidof docker` || sleep 10
|
||||||
|
else
|
||||||
echo "waiting clean shutdown"
|
echo "waiting clean shutdown"
|
||||||
sleep 10
|
sleep 10
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "docker is not running. starting docker"
|
||||||
|
|
||||||
# cleanup docker network checkpoint to avoid running into known issue
|
# cleanup docker network checkpoint to avoid running into known issue
|
||||||
# of docker (https://github.com/docker/docker/issues/18283)
|
# of docker (https://github.com/docker/docker/issues/18283)
|
||||||
rm -rf /var/lib/docker/network
|
rm -rf /var/lib/docker/network
|
||||||
@ -35,7 +46,7 @@ echo "waiting 30s for startup"
|
|||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
if ! sudo timeout 10 docker version > /dev/null; then
|
if ! timeout 60 docker ps > /dev/null; then
|
||||||
echo "Docker failed!"
|
echo "Docker failed!"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user