diff --git a/examples/buildkit3/buildkit.go b/examples/buildkit3/buildkit.go index 3a82d9e0b..0e76dd9a7 100644 --- a/examples/buildkit3/buildkit.go +++ b/examples/buildkit3/buildkit.go @@ -115,7 +115,7 @@ func copyFrom(src llb.State, srcPath, destPath string) llb.StateOption { // copy copies files between 2 states using cp until there is no copyOp func copy(src llb.State, srcPath string, dest llb.State, destPath string) llb.State { cpImage := llb.Image("docker.io/library/alpine:latest") - cp := cpImage.Run(llb.Shlexf("cp -a /src%s /dest%s", srcPath, destPath), llb.ReadonlyRootFS) + cp := cpImage.Run(llb.Shlexf("cp -a /src%s /dest%s", srcPath, destPath)) cp.AddMount("/src", src, llb.Readonly) return cp.AddMount("/dest", dest) } diff --git a/source/containerimage/pull.go b/source/containerimage/pull.go index 22a420c84..44dc1d4a4 100644 --- a/source/containerimage/pull.go +++ b/source/containerimage/pull.go @@ -2,7 +2,6 @@ package containerimage import ( gocontext "context" - "encoding/json" "fmt" "net/http" "sync" @@ -12,6 +11,7 @@ import ( "github.com/containerd/containerd/content" "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/images" + "github.com/containerd/containerd/platforms" "github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/rootfs" @@ -213,21 +213,17 @@ func (is *imageSource) fillBlobMapping(ctx context.Context, layers []rootfs.Laye } func getLayers(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) ([]rootfs.Layer, error) { - p, err := content.ReadBlob(ctx, provider, desc.Digest) + manifest, err := images.Manifest(ctx, provider, desc, platforms.Format(platforms.Default())) if err != nil { - return nil, errors.Wrapf(err, "failed to read manifest blob") - } - var manifest ocispec.Manifest - if err := json.Unmarshal(p, &manifest); err != nil { - return nil, errors.Wrap(err, "failed to unmarshal manifest") + return nil, errors.WithStack(err) } image := images.Image{Target: desc} - diffIDs, err := image.RootFS(ctx, provider, "") + diffIDs, err := image.RootFS(ctx, provider, platforms.Format(platforms.Default())) if err != nil { return nil, errors.Wrap(err, "failed to resolve rootfs") } if len(diffIDs) != len(manifest.Layers) { - return nil, errors.Errorf("mismatched image rootfs and manifest layers") + return nil, errors.Errorf("mismatched image rootfs and manifest layers %+v %+v", diffIDs, manifest.Layers) } layers := make([]rootfs.Layer, len(diffIDs)) for i := range diffIDs {