Преглед изворни кода

c8d/list: Skip images with non matching platform

Currently this won't have any real effect because the platform matcher
matches all platform and is only used for sorting.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski пре 1 година
родитељ
комит
2f1a32e3e5
1 измењених фајлова са 8 додато и 0 уклоњено
  1. 8 0
      daemon/containerd/image_list.go

+ 8 - 0
daemon/containerd/image_list.go

@@ -262,6 +262,14 @@ func (i *ImageService) imageSummary(ctx context.Context, img images.Image, platf
 			platform = dockerImage.Platform
 			platform = dockerImage.Platform
 		}
 		}
 
 
+		// Filter out platforms that don't match the requested platform.  Do it
+		// after the size, container count and chainIDs are summed up to have
+		// the single combined entry still represent the whole multi-platform
+		// image.
+		if !platformMatcher.Match(platform) {
+			return nil
+		}
+
 		if best == nil || platformMatcher.Less(platform, bestPlatform) {
 		if best == nil || platformMatcher.Less(platform, bestPlatform) {
 			best = img
 			best = img
 			bestPlatform = platform
 			bestPlatform = platform