Move exportContainerRw to the daemon.
Signed-off-by: David Calavera <david.calavera@gmail.com> Upstream-commit: 581380cc6cd26f43fe5e69965873769d8dc739ef Component: engine
This commit is contained in:
@@ -2,6 +2,8 @@ package daemon
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/runconfig"
|
||||
)
|
||||
|
||||
@@ -24,7 +26,7 @@ func (daemon *Daemon) Commit(container *Container, c *ContainerCommitConfig) (*i
|
||||
defer container.unpause()
|
||||
}
|
||||
|
||||
rwTar, err := container.exportContainerRw()
|
||||
rwTar, err := daemon.exportContainerRw(container)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -49,3 +51,15 @@ func (daemon *Daemon) Commit(container *Container, c *ContainerCommitConfig) (*i
|
||||
container.logEvent("commit")
|
||||
return img, nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) exportContainerRw(container *Container) (archive.Archive, error) {
|
||||
archive, err := daemon.diff(container)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ioutils.NewReadCloserWrapper(archive, func() error {
|
||||
err := archive.Close()
|
||||
return err
|
||||
}),
|
||||
nil
|
||||
}
|
||||
|
||||
@@ -225,21 +225,6 @@ func (container *Container) getRootResourcePath(path string) (string, error) {
|
||||
return symlink.FollowSymlinkInScope(filepath.Join(container.root, cleanPath), container.root)
|
||||
}
|
||||
|
||||
func (container *Container) exportContainerRw() (archive.Archive, error) {
|
||||
if container.daemon == nil {
|
||||
return nil, derr.ErrorCodeUnregisteredContainer.WithArgs(container.ID)
|
||||
}
|
||||
archive, err := container.daemon.diff(container)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ioutils.NewReadCloserWrapper(archive, func() error {
|
||||
err := archive.Close()
|
||||
return err
|
||||
}),
|
||||
nil
|
||||
}
|
||||
|
||||
// Start prepares the container to run by setting up everything the
|
||||
// container needs, such as storage and networking, as well as links
|
||||
// between containers. The container is left waiting for a signal to
|
||||
|
||||
Reference in New Issue
Block a user