From a9c1575b1a248305290731ade24eab784ff95d55 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Thu, 29 Sep 2016 08:35:10 -0700 Subject: [PATCH] Fix name collision handling in restore Signed-off-by: Tonis Tiigi --- daemon/daemon.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/daemon.go b/daemon/daemon.go index 9911f3d2a3..4e7db85472 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -152,13 +152,15 @@ func (daemon *Daemon) restore() error { removeContainers := make(map[string]*container.Container) restartContainers := make(map[*container.Container]chan struct{}) activeSandboxes := make(map[string]interface{}) - for _, c := range containers { + for id, c := range containers { if err := daemon.registerName(c); err != nil { logrus.Errorf("Failed to register container %s: %s", c.ID, err) + delete(containers, id) continue } if err := daemon.Register(c); err != nil { logrus.Errorf("Failed to register container %s: %s", c.ID, err) + delete(containers, id) continue }