Skip to content

Commit

Permalink
copyFromVirtualization return reader of text bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
zc authored and CMGS committed Mar 13, 2020
1 parent de2f48e commit c507ac3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion engine/docker/container.go
@@ -1,6 +1,7 @@
package docker

import (
"archive/tar"
"context"
"fmt"
"io"
Expand All @@ -12,6 +13,7 @@ import (

"github.com/docker/go-connections/nat"
"github.com/docker/go-units"
"github.com/pkg/errors"

log "github.com/sirupsen/logrus"

Expand Down Expand Up @@ -350,5 +352,7 @@ func (e *Engine) VirtualizationCopyFrom(ctx context.Context, ID, path string) (i
if err != nil {
return nil, "", err
}
return resp, stat.Name, err
tarReader := tar.NewReader(resp)
_, err = tarReader.Next()
return ioutil.NopCloser(tarReader), stat.Name, errors.Wrapf(err, "read tarball from docker API failed: %s", path)
}

0 comments on commit c507ac3

Please sign in to comment.