Update rc.docker

- kill containers which are still running before stopping dockerd gracefully
This commit is contained in:
Christoph Hummer
2023-09-25 20:28:06 +02:00
committed by GitHub
parent cb513ed29b
commit 3cda86d099

View File

@@ -578,6 +578,9 @@ stop_docker(){
echo "$DOCKERD is not running..."
return 1
fi
# Kill containers if still running
docker kill $(docker ps -q) 2>/dev/null
# Try to stop dockerd gracefully
kill $(docker_pid) 2>/dev/null
# must ensure daemon has exited
for n in {1..15}; do
@@ -595,8 +598,6 @@ stop_docker(){
echo "waiting for $DOCKERD to die ..."
done
echo "$DOCKERD will not die! killing $DOCKERD ..."
# Kill containers if still running
docker kill $(docker ps -q) 2>/dev/null
# Send SIGKILL to dockerd
kill -SIGKILL $(docker_pid) 2>/dev/null
# Remove .sock and .pid