Add docker upstart pre-stop and post-start events to prevent race conditions

An attempt to fix issue #6647
I realized that there aren't much any difference with waiting for this
event to happen (`start on docker-up`) and waiting for this service to run
(`start on started docker`). There's a slight delay in waiting for the
later event so it sort of improved the race condition a bit. This did not
really fix it.


On Wed, Jul 30, 2014 at 1:19 AM, Tianon Gravi <notifications@github.com>
wrote:

> In contrib/init/upstart/docker.conf:
>
> > @@ -30,6 +31,16 @@ pre-start script
> >  	)
> >  end script
> >
> > +post-start script
> > +	# Start docker containers after docker has completely started.
> > +	initctl emit docker-up
>
> Since you're not waiting for the socket to exist here, how do you know
> Docker is actually up at this point? Won't this have the same racy behavior
> as just waiting for the "docker" event, or is there some Upstart magic here
> I'm not familiar with? :) (My knowledge of the deeper, darker Upstart magic
> is admittedly lax.)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/docker/docker/pull/7297/files#r15537850>.
>