فهرست منبع

c8d/list: Fix premature `Images` return

52a80b40e25372f6f6c320bbeebe652199a81914 extracted the `imageSummary`
function but introduced a bug causing the whole caller function to
return if the image should be skipped.

`imageSummary` returns a nil error and nil image when the image doesn't
have any platform or all its platforms are not available locally.
In this case that particular image should be skipped, instead of failing
the whole image list operation.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski 1 سال پیش
والد
کامیت
f512dba037
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      daemon/containerd/image_list.go

+ 5 - 1
daemon/containerd/image_list.go

@@ -154,9 +154,13 @@ func (i *ImageService) Images(ctx context.Context, opts imagetypes.ListOptions)
 
 	for _, img := range uniqueImages {
 		image, allChainsIDs, err := i.imageSummary(ctx, img, platformMatcher, opts, tagsByDigest)
-		if err != nil || image == nil {
+		if err != nil {
 			return nil, err
 		}
+		// No error, but image should be skipped.
+		if image == nil {
+			continue
+		}
 
 		summaries = append(summaries, image)