|
| 1 | +From a7ef4a208d96a71162ed3b0f04ec90112ead44fd Mon Sep 17 00:00:00 2001 |
| 2 | +From: henry118 <henryw@amazon.com> |
| 3 | +Date: Sat, 10 May 2025 00:00:00 +0000 |
| 4 | +Subject: [PATCH] Fix multiarch image push tag for containerd snapshotter |
| 5 | + |
| 6 | +When the "containerd-snapshotter" feature is enabled and pushing multiarch |
| 7 | +images, all platform specific image manifests should be pushed by digest, |
| 8 | +but only the top level manifest index should be pushed by tag. In the previous |
| 9 | +implementation in moby, all of them were pushed by tag. |
| 10 | + |
| 11 | +This replicates the similar logic in containerd: |
| 12 | +https://github.com/containerd/containerd/blob/main/client/client.go#L485-L488 |
| 13 | + |
| 14 | +Signed-off-by: henry118 <henryw@amazon.com> |
| 15 | +--- |
| 16 | + daemon/containerd/image_push.go | 11 ++++++++++- |
| 17 | + 1 file changed, 10 insertions(+), 1 deletion(-) |
| 18 | + |
| 19 | +diff --git a/daemon/containerd/image_push.go b/daemon/containerd/image_push.go |
| 20 | +index 1234567..abcdefg 100644 |
| 21 | +--- a/daemon/containerd/image_push.go |
| 22 | ++++ b/daemon/containerd/image_push.go |
| 23 | +@@ -144,7 +144,16 @@ func (i *ImageService) pushRef(ctx context.Context, targetRef reference.Named, p |
| 24 | + wrapped := wrapWithFakeMountableBlobs(store, mountableBlobs) |
| 25 | + store = wrapped |
| 26 | + |
| 27 | +- pusher, err := resolver.Pusher(ctx, targetRef.String()) |
| 28 | ++ // Annotate ref with digest to push only push tag for single digest |
| 29 | ++ ref := targetRef |
| 30 | ++ if _, digested := ref.(reference.Digested); !digested { |
| 31 | ++ ref, err = reference.WithDigest(ref, target.Digest) |
| 32 | ++ if err != nil { |
| 33 | ++ return err |
| 34 | ++ } |
| 35 | ++ } |
| 36 | ++ |
| 37 | ++ pusher, err := resolver.Pusher(ctx, ref.String()) |
| 38 | + if err != nil { |
| 39 | + return err |
| 40 | + } |
| 41 | +-- |
| 42 | +2.39.0 |
0 commit comments