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

Tested on a server running on ubuntu 14.04 and docker 1.1.2. This should fix issue #6647