mirror of
https://github.com/docker/docs.git
synced 2026-04-12 06:19:22 +07:00
Merge pull request #13536 from Mic92/master
remove redundant mount/unmount calls on commit
This commit is contained in:
@@ -23,11 +23,6 @@ func (daemon *Daemon) Commit(container *Container, repository, tag, comment, aut
|
||||
defer container.Unpause()
|
||||
}
|
||||
|
||||
if err := container.Mount(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer container.Unmount()
|
||||
|
||||
rwTar, err := container.ExportRw()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -838,20 +838,15 @@ func (container *Container) verifyDaemonSettings() {
|
||||
}
|
||||
|
||||
func (container *Container) ExportRw() (archive.Archive, error) {
|
||||
if err := container.Mount(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if container.daemon == nil {
|
||||
return nil, fmt.Errorf("Can't load storage driver for unregistered container %s", container.ID)
|
||||
}
|
||||
archive, err := container.daemon.Diff(container)
|
||||
if err != nil {
|
||||
container.Unmount()
|
||||
return nil, err
|
||||
}
|
||||
return ioutils.NewReadCloserWrapper(archive, func() error {
|
||||
err := archive.Close()
|
||||
container.Unmount()
|
||||
return err
|
||||
}),
|
||||
nil
|
||||
|
||||
Reference in New Issue
Block a user