1
0
mirror of https://github.com/docker/cli.git synced 2026-01-16 20:22:36 +03:00

Merge pull request #4180 from alexlarsson/fix-restart-race

Avoid temporarily unmounting the container when restarting it
Upstream-commit: 1f66296c6e725d08be8560f7f2d6ce99413af170
Component: engine
This commit is contained in:
Michael Crosby
2014-02-17 13:21:53 -05:00

View File

@@ -1256,6 +1256,13 @@ func (container *Container) Stop(seconds int) error {
}
func (container *Container) Restart(seconds int) error {
// Avoid unnecessarily unmounting and then directly mounting
// the container when the container stops and then starts
// again
if err := container.Mount(); err == nil {
defer container.Unmount()
}
if err := container.Stop(seconds); err != nil {
return err
}