mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-04 04:31:28 +00:00
Merge pull request #4180 from alexlarsson/fix-restart-race
Avoid temporarily unmounting the container when restarting it
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user