|
@@ -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
|