Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions images/builder/docker/docker-builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ if [ -n "$DOCKER_REGISTRY" ]; then
docker push $TAG
fi

if $NEED_DIND; then
kill -15 $(cat /var/run/docker.pid)
if [ $NEED_DIND == "true" ]; then
docker_pid=$(cat /var/run/docker.pid)
kill -15 $docker_pid

# wait up to 10 seconds for the Docker daemon to stop
#
# if it takes longer than that, something is probably wrong
# and we may end up leaking loopback devices
ATTEMPTS=0
while [ $ATTEMPTS -lt 10 ]; do
ps -p $docker_pid &> /dev/null
if [ $? -eq 0 ]; then
let ATTEMPTS=ATTEMPTS+1
sleep 1
else
break
fi
done
fi
18 changes: 17 additions & 1 deletion images/builder/docker/sti-builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,21 @@ if [ -n "$DOCKER_REGISTRY" ]; then
fi

if [ $NEED_DIND == "true" ]; then
kill -15 $(cat /var/run/docker.pid)
docker_pid=$(cat /var/run/docker.pid)
kill -15 $docker_pid

# wait up to 10 seconds for the Docker daemon to stop
#
# if it takes longer than that, something is probably wrong
# and we may end up leaking loopback devices
ATTEMPTS=0
while [ $ATTEMPTS -lt 10 ]; do
ps -p $docker_pid &> /dev/null
if [ $? -eq 0 ]; then
let ATTEMPTS=ATTEMPTS+1
sleep 1
else
break
fi
done
fi