зеркало из https://github.com/microsoft/docker.git
Make sure the destination directory exists when using docker insert
This commit is contained in:
Родитель
9751483112
Коммит
9db4972a70
|
@ -110,7 +110,7 @@ func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit the container
|
// Commit the container
|
||||||
base, err := builder.Commit(c, "", "", "", "")
|
base, err = builder.Commit(c, "", "", "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ func (srv *Server) CmdInsert(stdin io.ReadCloser, stdout rcli.DockerConn, args .
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(stdout, "%s\n", img)
|
fmt.Fprintf(stdout, "%s\n", img.Id)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,12 @@ func (settings *NetworkSettings) PortMappingHuman() string {
|
||||||
|
|
||||||
// Inject the io.Reader at the given path. Note: do not close the reader
|
// Inject the io.Reader at the given path. Note: do not close the reader
|
||||||
func (container *Container) Inject(file io.Reader, pth string) error {
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче