Ensure docker cp stream is closes properly
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
da3e539133
commit
35821ad78f
2 changed files with 3 additions and 2 deletions
|
@ -1562,7 +1562,7 @@ func (container *Container) GetSize() (int64, int64) {
|
|||
return sizeRw, sizeRootfs
|
||||
}
|
||||
|
||||
func (container *Container) Copy(resource string) (archive.Archive, error) {
|
||||
func (container *Container) Copy(resource string) (io.ReadCloser, error) {
|
||||
if err := container.Mount(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1589,7 +1589,7 @@ func (container *Container) Copy(resource string) (archive.Archive, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return EofReader(archive, func() { container.Unmount() }), nil
|
||||
return utils.NewReadCloserWrapper(archive, container.Unmount), nil
|
||||
}
|
||||
|
||||
// Returns true if the container exposes a certain port
|
||||
|
|
|
@ -2339,6 +2339,7 @@ func (srv *Server) ContainerCopy(job *engine.Job) engine.Status {
|
|||
if err != nil {
|
||||
return job.Error(err)
|
||||
}
|
||||
defer data.Close()
|
||||
|
||||
if _, err := io.Copy(job.Stdout, data); err != nil {
|
||||
return job.Error(err)
|
||||
|
|
Loading…
Reference in a new issue