Skip to content

Commit

Permalink
Avoid temporarily unmounting the container when restarting it
Browse files Browse the repository at this point in the history
Stopping the container will typicall cause it to unmount, to keep it mounted
over the stop/start cycle we aquire a temporary reference to it during this time.

This helps with moby#4036

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
  • Loading branch information
alexlarsson committed Feb 17, 2014
1 parent 72ed253 commit ab0f3f8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit ab0f3f8

Please sign in to comment.