mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix unmounts out of container export funcs
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
d277a4c0f8
commit
02fdc194fc
1 changed files with 7 additions and 3 deletions
10
container.go
10
container.go
|
@ -1416,9 +1416,12 @@ func (container *Container) ExportRw() (archive.Archive, error) {
|
|||
if container.runtime == nil {
|
||||
return nil, fmt.Errorf("Can't load storage driver for unregistered container %s", container.ID)
|
||||
}
|
||||
defer container.Unmount()
|
||||
|
||||
return container.runtime.Diff(container)
|
||||
archive, err := container.runtime.Diff(container)
|
||||
if err != nil {
|
||||
container.Unmount()
|
||||
return nil, err
|
||||
}
|
||||
return EofReader(archive, func() { container.Unmount() }), nil
|
||||
}
|
||||
|
||||
func (container *Container) Export() (archive.Archive, error) {
|
||||
|
@ -1428,6 +1431,7 @@ func (container *Container) Export() (archive.Archive, error) {
|
|||
|
||||
archive, err := archive.Tar(container.basefs, archive.Uncompressed)
|
||||
if err != nil {
|
||||
container.Unmount()
|
||||
return nil, err
|
||||
}
|
||||
return EofReader(archive, func() { container.Unmount() }), nil
|
||||
|
|
Loading…
Add table
Reference in a new issue