diff --git a/daemon/daemon.go b/daemon/daemon.go index 3d036328cc..5410d14156 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -769,16 +769,6 @@ func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemo } func (daemon *Daemon) Shutdown() error { - if daemon.containerGraph != nil { - if err := daemon.containerGraph.Close(); err != nil { - logrus.Errorf("Error during container graph.Close(): %v", err) - } - } - if daemon.driver != nil { - if err := daemon.driver.Cleanup(); err != nil { - logrus.Errorf("Error during graph storage driver.Cleanup(): %v", err) - } - } if daemon.containers != nil { group := sync.WaitGroup{} logrus.Debug("starting clean shutdown of all containers...") @@ -807,6 +797,18 @@ func (daemon *Daemon) Shutdown() error { } } + if daemon.containerGraph != nil { + if err := daemon.containerGraph.Close(); err != nil { + logrus.Errorf("Error during container graph.Close(): %v", err) + } + } + + if daemon.driver != nil { + if err := daemon.driver.Cleanup(); err != nil { + logrus.Errorf("Error during graph storage driver.Cleanup(): %v", err) + } + } + return nil }