diff --git a/builder/builder.go b/builder/builder.go index caff35aead..07293f4f8e 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -141,12 +141,6 @@ type Backend interface { //ContainerCopy(name string, res string) (io.ReadCloser, error) // TODO: use copyBackend api BuilderCopy(containerID string, destPath string, src FileInfo, decompress bool) error - - // TODO: remove - // Mount mounts the root filesystem for the container. - Mount(containerID string) error - // Unmount unmounts the root filesystem for the container. - Unmount(containerID string) error } // ImageCache abstracts an image cache store. diff --git a/builder/dockerfile/dispatchers.go b/builder/dockerfile/dispatchers.go index 97f50bb4e9..038a2c8c61 100644 --- a/builder/dockerfile/dispatchers.go +++ b/builder/dockerfile/dispatchers.go @@ -399,9 +399,6 @@ func run(b *Builder, args []string, attributes map[string]bool, original string) return err } - b.docker.Mount(cID) - defer b.docker.Unmount(cID) - if err := b.run(cID); err != nil { return err } diff --git a/builder/dockerfile/internals.go b/builder/dockerfile/internals.go index 0d87c12b04..c8e674d7bc 100644 --- a/builder/dockerfile/internals.go +++ b/builder/dockerfile/internals.go @@ -66,10 +66,6 @@ func (b *Builder) commit(id string, autoCmd *stringutils.StrSlice, comment strin if err != nil { return err } - if err := b.docker.Mount(id); err != nil { - return err - } - defer b.docker.Unmount(id) } // Note: Actually copy the struct @@ -193,10 +189,6 @@ func (b *Builder) runContextCommand(args []string, allowRemote bool, allowLocalD if err != nil { return err } - if err := b.docker.Mount(container.ID); err != nil { - return err - } - defer b.docker.Unmount(container.ID) b.tmpContainers[container.ID] = struct{}{} comment := fmt.Sprintf("%s %s in %s", cmdName, origPaths, dest) diff --git a/daemon/daemonbuilder/builder.go b/daemon/daemonbuilder/builder.go index 6da9896301..5c44735113 100644 --- a/daemon/daemonbuilder/builder.go +++ b/daemon/daemonbuilder/builder.go @@ -112,6 +112,12 @@ func (d Docker) BuilderCopy(cID string, destPath string, src builder.FileInfo, d if err != nil { return err } + err = d.Daemon.Mount(c) + if err != nil { + return err + } + defer d.Daemon.Unmount(c) + dest, err := c.GetResourcePath(destPath) if err != nil { return err @@ -176,25 +182,6 @@ func (d Docker) BuilderCopy(cID string, destPath string, src builder.FileInfo, d return fixPermissions(srcPath, destPath, rootUID, rootGID, destExists) } -// Mount mounts the root filesystem for the container. -func (d Docker) Mount(cID string) error { - c, err := d.Daemon.GetContainer(cID) - if err != nil { - return err - } - return d.Daemon.Mount(c) -} - -// Unmount unmounts the root filesystem for the container. -func (d Docker) Unmount(cID string) error { - c, err := d.Daemon.GetContainer(cID) - if err != nil { - return err - } - d.Daemon.Unmount(c) - return nil -} - // GetCachedImage returns a reference to a cached image whose parent equals `parent` // and runconfig equals `cfg`. A cache miss is expected to return an empty ID and a nil error. func (d Docker) GetCachedImage(imgID string, cfg *runconfig.Config) (string, error) {