diff --git a/cluster/engine.go b/cluster/engine.go index c489ed57d6..5b7b5e58f1 100644 --- a/cluster/engine.go +++ b/cluster/engine.go @@ -721,10 +721,10 @@ func (e *Engine) Create(config *ContainerConfig, name string, pullImage bool, au e.RefreshVolumes() e.RefreshNetworks() - e.RLock() - defer e.RUnlock() - + e.Lock() container := e.containers[id] + e.Unlock() + if container == nil { err = errors.New("Container created but refresh didn't report it back") } diff --git a/cluster/watchdog.go b/cluster/watchdog.go index e91a27b0a3..28b6708cf4 100644 --- a/cluster/watchdog.go +++ b/cluster/watchdog.go @@ -76,12 +76,13 @@ func (w *Watchdog) rescheduleContainers(e *Engine) { newContainer, err := w.cluster.CreateContainer(c.Config, c.Info.Name, nil) if err != nil { - log.Errorf("Failed to reschedule container %s (Swarm ID: %s): %v", c.Id, c.Config.SwarmID(), err) + log.Errorf("Failed to reschedule container %s: %v", c.Id, err) // add the container back, so we can retry later c.Engine.AddContainer(c) } else { - log.Infof("Rescheduled container %s from %s to %s as %s (Swarm ID: %s)", c.Id, c.Engine.ID, newContainer.Engine.ID, newContainer.Id, c.Config.SwarmID()) + log.Infof("Rescheduled container %s from %s to %s as %s", c.Id, c.Engine.Name, newContainer.Engine.Name, newContainer.Id) if c.Info.State.Running { + log.Infof("Container %s was running, starting container %s", c.Id, newContainer.Id) if err := newContainer.Start(); err != nil { log.Errorf("Failed to start rescheduled container %s", newContainer.Id) }