瀏覽代碼

Merge pull request #27027 from tonistiigi/fix-name-collision

Fix name collision handling in restore
Tibor Vass 8 年之前
父節點
當前提交
9ced849832
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      daemon/daemon.go

+ 3 - 1
daemon/daemon.go

@@ -153,13 +153,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
 		}