浏览代码

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)