Skip to content

Commit

Permalink
pkill with condition
Browse files Browse the repository at this point in the history
  • Loading branch information
samruddhikhandale committed Sep 28, 2023
1 parent 52903a0 commit e0c29ab
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/docker-in-docker/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ EOF
tee -a /usr/local/share/docker-init.sh > /dev/null \
<< 'EOF'
dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAULT_ADDRESS_POOL=${DOCKER_DEFAULT_ADDRESS_POOL} $(cat << 'INNEREOF'
# Stop dockerd and containerd in case they are already running
docker info > /dev/null 2>&1 && pkill dockerd && pkill containerd
# explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly
find /run /var/run -iname 'docker*.pid' -delete || :
find /run /var/run -iname 'container*.pid' -delete || :
Expand Down Expand Up @@ -468,15 +470,6 @@ do
if [ "${docker_ok}" != "true" ]; then
echo "(*) Failed to start docker, retrying..."
# Stop dockerd and containerd in case they are already running
if [ "$(id -u)" -ne 0 ]; then
sudo pkill dockerd
sudo pkill containerd
else
pkill dockerd
pkill containerd
fi
fi
retry_docker_start_count=`expr $retry_docker_start_count + 1`
Expand Down

0 comments on commit e0c29ab

Please sign in to comment.