Skip to content

Commit

Permalink
Ensure content is fetched on save
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <[email protected]>
  • Loading branch information
apostasie committed Sep 24, 2024
1 parent a430fae commit 88726e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/cmd/image/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/containerd/nerdctl/v2/pkg/api/types"
"github.com/containerd/nerdctl/v2/pkg/idutil/imagewalker"
"github.com/containerd/nerdctl/v2/pkg/imgutil"
"github.com/containerd/nerdctl/v2/pkg/platformutil"
"github.com/containerd/nerdctl/v2/pkg/strutil"
)
Expand All @@ -48,6 +49,11 @@ func Save(ctx context.Context, client *containerd.Client, images []string, optio
if found.UniqueImages > 1 {
return fmt.Errorf("ambiguous digest ID: multiple IDs found with provided prefix %s", found.Req)
}
err = imgutil.EnsureAllContent(ctx, client, found.Image.Name, found.Image.Target, "", options.GOptions)
if err != nil {
return err
}

imgName := found.Image.Name
imgDigest := found.Image.Target.Digest.String()
if _, ok := savedImages[imgDigest]; !ok {
Expand Down

0 comments on commit 88726e9

Please sign in to comment.