diff --git a/container.go b/container.go index 3740a7fb73d718828351b8a399e13bfe945d7894..f55b8c3c7b98124b00b3edf68d0e8c61a8edaa17 100644 --- a/container.go +++ b/container.go @@ -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 }