@@ -27,6 +27,7 @@ import (
2727 containerd "github.com/containerd/containerd/v2/client"
2828 "github.com/containerd/containerd/v2/core/images"
2929 "github.com/containerd/log"
30+ "github.com/containerd/platforms"
3031
3132 "github.com/containerd/nerdctl/v2/pkg/api/types"
3233 "github.com/containerd/nerdctl/v2/pkg/containerdutil"
@@ -37,7 +38,7 @@ import (
3738 "github.com/containerd/nerdctl/v2/pkg/referenceutil"
3839)
3940
40- func EnsureAllContent (ctx context.Context , client * containerd.Client , srcName string , options types.GlobalCommandOptions ) error {
41+ func EnsureAllContent (ctx context.Context , client * containerd.Client , srcName string , platMC platforms. MatchComparer , options types.GlobalCommandOptions ) error {
4142 // Get the image from the srcName
4243 imageService := client .ImageService ()
4344 img , err := imageService .Get (ctx , srcName )
@@ -51,9 +52,11 @@ func EnsureAllContent(ctx context.Context, client *containerd.Client, srcName st
5152 imagesList , _ := read (ctx , provider , snapshotter , img .Target )
5253 // Iterate through the list
5354 for _ , i := range imagesList {
54- err = ensureOne (ctx , client , srcName , img .Target , i .platform , options )
55- if err != nil {
56- return err
55+ if platMC .Match (i .platform ) {
56+ err = ensureOne (ctx , client , srcName , img .Target , i .platform , options )
57+ if err != nil {
58+ return err
59+ }
5760 }
5861 }
5962
0 commit comments