mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #9287 from drothlis/fix-upstart-race-condition
upstart: Don't emit "started" event until docker.sock is available
This commit is contained in:
commit
ad8096a1c2
1 changed files with 17 additions and 0 deletions
|
@ -39,3 +39,20 @@ script
|
||||||
fi
|
fi
|
||||||
exec "$DOCKER" -d $DOCKER_OPTS
|
exec "$DOCKER" -d $DOCKER_OPTS
|
||||||
end script
|
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue