diff --git a/container/stream/streams.go b/container/stream/streams.go index 79f366afda..bbfe4af61d 100644 --- a/container/stream/streams.go +++ b/container/stream/streams.go @@ -113,12 +113,13 @@ func (c *Config) CloseStreams() error { // CopyToPipe connects streamconfig with a libcontainerd.IOPipe func (c *Config) CopyToPipe(iop libcontainerd.IOPipe) { - copyFunc := func(w io.Writer, r io.Reader) { + copyFunc := func(w io.Writer, r io.ReadCloser) { c.Add(1) go func() { if _, err := pools.Copy(w, r); err != nil { logrus.Errorf("stream copy error: %+v", err) } + r.Close() c.Done() }() }