From c1388010731cac1c8ff5159bd72b926545a64e58 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 9 Sep 2013 15:56:59 +0200 Subject: [PATCH] Container: Inject into the mount, not the rwPath For device-mapper setups we can't just push the file into the rwPath. --- container.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/container.go b/container.go index cd143f7236..002e2eb31e 100644 --- a/container.go +++ b/container.go @@ -297,12 +297,17 @@ func (settings *NetworkSettings) PortMappingAPI() []APIPort { // Inject the io.Reader at the given path. Note: do not close the reader func (container *Container) Inject(file io.Reader, pth string) error { - // Make sure the directory exists - if err := os.MkdirAll(path.Join(container.rwPath(), path.Dir(pth)), 0755); err != nil { + if err := container.EnsureMounted(); err != nil { return err } + + // Make sure the directory exists + if err := os.MkdirAll(path.Join(container.RootfsPath(), path.Dir(pth)), 0755); err != nil { + return err + } + // FIXME: Handle permissions/already existing dest - dest, err := os.Create(path.Join(container.rwPath(), pth)) + dest, err := os.Create(path.Join(container.RootfsPath(), pth)) if err != nil { return err }