func newContainerDownloader(client *docker.Client, container, path string) io.ReadCloser { r, w := io.Pipe() go func() { opts := docker.DownloadFromContainerOptions{ Path: path, OutputStream: w, } w.CloseWithError(client.DownloadFromContainer(container, opts)) }() return r }