diff --git a/builder.go b/builder.go index b15a71d621a6b3ee1d11e0b00e926df54ca90b1f..717525831b0d404bfd52a503518f3b8a5f6341dc 100644 --- a/builder.go +++ b/builder.go @@ -110,7 +110,7 @@ func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) error { } // Commit the container - base, err := builder.Commit(c, "", "", "", "") + base, err = builder.Commit(c, "", "", "", "") if err != nil { return err } diff --git a/commands.go b/commands.go index 21c8b68abc72cd85e8ecc45e2a5fedfbb61fe46d..9d848b95dbd4daec0181d01816f5cdd961d53609 100644 --- a/commands.go +++ b/commands.go @@ -105,7 +105,7 @@ func (srv *Server) CmdInsert(stdin io.ReadCloser, stdout rcli.DockerConn, args . if err != nil { return err } - fmt.Fprintf(stdout, "%s\n", img) + fmt.Fprintf(stdout, "%s\n", img.Id) return nil } diff --git a/container.go b/container.go index ed3bdce94ad979194e6d2270a609e6f04ba989b1..a4bee6a6fe5633a902efa2327198875245e55da6 100644 --- a/container.go +++ b/container.go @@ -180,7 +180,12 @@ func (settings *NetworkSettings) PortMappingHuman() string { // Inject the io.Reader at the given path. Note: do not close the reader func (container *Container) Inject(file io.Reader, pth string) error { - dest, err := os.Open(path.Join(container.rwPath(), pth)) + // Make sure the directory exists + if err := os.MkdirAll(path.Join(container.rwPath(), path.Dir(pth)), 0755); err != nil { + return err + } + // FIXME: Handle permissions/already existing dest + dest, err := os.Create(path.Join(container.rwPath(), pth)) if err != nil { return err }