Fix name collision handling in restore
| ... | ... |
@@ -153,13 +153,15 @@ func (daemon *Daemon) restore() error {
|
| 153 | 153 |
removeContainers := make(map[string]*container.Container) |
| 154 | 154 |
restartContainers := make(map[*container.Container]chan struct{})
|
| 155 | 155 |
activeSandboxes := make(map[string]interface{})
|
| 156 |
- for _, c := range containers {
|
|
| 156 |
+ for id, c := range containers {
|
|
| 157 | 157 |
if err := daemon.registerName(c); err != nil {
|
| 158 | 158 |
logrus.Errorf("Failed to register container %s: %s", c.ID, err)
|
| 159 |
+ delete(containers, id) |
|
| 159 | 160 |
continue |
| 160 | 161 |
} |
| 161 | 162 |
if err := daemon.Register(c); err != nil {
|
| 162 | 163 |
logrus.Errorf("Failed to register container %s: %s", c.ID, err)
|
| 164 |
+ delete(containers, id) |
|
| 163 | 165 |
continue |
| 164 | 166 |
} |
| 165 | 167 |
|