Update layer apply to use containerd archive
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
0deba01621
commit
f0a43e72cd
2 changed files with 18 additions and 4 deletions
11
cmd/dist/apply.go
vendored
11
cmd/dist/apply.go
vendored
|
@ -4,8 +4,9 @@ import (
|
|||
contextpkg "context"
|
||||
"os"
|
||||
|
||||
"github.com/docker/containerd/archive"
|
||||
"github.com/docker/containerd/log"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
dockerarchive "github.com/docker/docker/pkg/archive"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
@ -21,7 +22,13 @@ var applyCommand = cli.Command{
|
|||
)
|
||||
|
||||
log.G(ctx).Info("applying layer from stdin")
|
||||
if _, err := archive.ApplyLayer(dir, os.Stdin); err != nil {
|
||||
|
||||
rd, err := dockerarchive.DecompressStream(os.Stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := archive.ApplyDiffTar(ctx, dir, rd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package rootfs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/docker/containerd"
|
||||
"github.com/docker/containerd/archive"
|
||||
"github.com/docker/containerd/log"
|
||||
"github.com/docker/containerd/snapshot"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
dockerarchive "github.com/docker/docker/pkg/archive"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/image-spec/identity"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
@ -56,7 +58,12 @@ func ApplyLayer(snapshots snapshot.Snapshotter, mounter Mounter, rd io.Reader, p
|
|||
}
|
||||
defer mounter.Unmount(mounts...)
|
||||
|
||||
if _, err := archive.ApplyLayer(key, rd); err != nil {
|
||||
rd, err = dockerarchive.DecompressStream(rd)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if _, err := archive.ApplyDiffTar(context.Background(), key, rd); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue