Merge pull request #26005 from q384566678/branch-test
Optimize the restart function code
This commit is contained in:
commit
07328cf3f6
|
@ -36,6 +36,7 @@ func (daemon *Daemon) containerRestart(container *container.Container, seconds i
|
|||
defer daemon.Unmount(container)
|
||||
}
|
||||
|
||||
if container.IsRunning() {
|
||||
// set AutoRemove flag to false before stop so the container won't be
|
||||
// removed during restart process
|
||||
autoRemove := container.HostConfig.AutoRemove
|
||||
|
@ -53,8 +54,9 @@ func (daemon *Daemon) containerRestart(container *container.Container, seconds i
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err = daemon.containerStart(container); err != nil {
|
||||
if err := daemon.containerStart(container); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue