Skip to content

Commit

Permalink
Merge pull request #9287 from drothlis/fix-upstart-race-condition
Browse files Browse the repository at this point in the history
upstart: Don't emit "started" event until docker.sock is available
  • Loading branch information
Jessie Frazelle committed Dec 16, 2014
2 parents e927ab0 + f42c0a5 commit ad8096a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions contrib/init/upstart/docker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,20 @@ script
fi
exec "$DOCKER" -d $DOCKER_OPTS
end script

# Don't emit "started" event until docker.sock is ready.
# See https://github.com/docker/docker/issues/6647
post-start script
DOCKER_OPTS=
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if ! printf "%s" "$DOCKER_OPTS" | grep -qE -e '-H|--host'; then
while ! [ -e /var/run/docker.sock ]; do
initctl status $UPSTART_JOB | grep -q "stop/" && exit 1
echo "Waiting for /var/run/docker.sock"
sleep 0.1
done
echo "/var/run/docker.sock is up"
fi
end script

0 comments on commit ad8096a

Please sign in to comment.