@@ -43,6 +43,7 @@ import (
43
43
44
44
"github.com/containerd/nerdctl/v2/pkg/api/types"
45
45
"github.com/containerd/nerdctl/v2/pkg/errutil"
46
+ nerdconverter "github.com/containerd/nerdctl/v2/pkg/imgutil/converter"
46
47
"github.com/containerd/nerdctl/v2/pkg/imgutil/dockerconfigresolver"
47
48
"github.com/containerd/nerdctl/v2/pkg/imgutil/push"
48
49
"github.com/containerd/nerdctl/v2/pkg/ipfs"
@@ -119,7 +120,12 @@ func Push(ctx context.Context, client *containerd.Client, rawRef string, options
119
120
pushRef = ref + "-tmp-reduced-platform"
120
121
// Push fails with "400 Bad Request" when the manifest is multi-platform but we do not locally have multi-platform blobs.
121
122
// So we create a tmp reduced-platform image to avoid the error.
122
- platImg , err := converter .Convert (ctx , client , pushRef , ref , converter .WithPlatform (platMC ))
123
+ // Ensure all the layers are here: https://github.com/containerd/nerdctl/issues/3425
124
+ err = EnsureAllContent (ctx , client , ref , platMC , options .GOptions )
125
+ if err != nil {
126
+ return err
127
+ }
128
+ platImg , err := nerdconverter .Convert (ctx , client , pushRef , ref , converter .WithPlatform (platMC ))
123
129
if err != nil {
124
130
if len (options .Platforms ) == 0 {
125
131
return fmt .Errorf ("failed to create a tmp single-platform image %q: %w" , pushRef , err )
@@ -132,7 +138,7 @@ func Push(ctx context.Context, client *containerd.Client, rawRef string, options
132
138
133
139
if options .Estargz {
134
140
pushRef = ref + "-tmp-esgz"
135
- esgzImg , err := converter .Convert (ctx , client , pushRef , ref , converter .WithPlatform (platMC ), converter .WithLayerConvertFunc (eStargzConvertFunc ()))
141
+ esgzImg , err := nerdconverter .Convert (ctx , client , pushRef , ref , converter .WithPlatform (platMC ), converter .WithLayerConvertFunc (eStargzConvertFunc ()))
136
142
if err != nil {
137
143
return fmt .Errorf ("failed to convert to eStargz: %v" , err )
138
144
}
0 commit comments