Browse code

fix #29199, reset container if container start failed

Signed-off-by: Lei Jitang <leijitang@huawei.com>

Lei Jitang authored on 2016/12/07 15:37:08
Showing 1 changed files
... ...
@@ -119,6 +119,9 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint
119 119
 				container.SetExitCode(128)
120 120
 			}
121 121
 			container.ToDisk()
122
+
123
+			container.Reset(false)
124
+
122 125
 			daemon.Cleanup(container)
123 126
 			// if containers AutoRemove flag is set, remove it after clean up
124 127
 			if container.HostConfig.AutoRemove {
... ...
@@ -187,8 +190,6 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint
187 187
 			container.SetExitCode(127)
188 188
 		}
189 189
 
190
-		container.Reset(false)
191
-
192 190
 		return fmt.Errorf("%s", errDesc)
193 191
 	}
194 192