Skip to content

Commit

Permalink
c8d/list: Skip images with non matching platform
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vvoland committed Mar 7, 2024
1 parent 72f1f82 commit 2f1a32e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions daemon/containerd/image_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ func (i *ImageService) imageSummary(ctx context.Context, img images.Image, platf
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) {
best = img
bestPlatform = platform
Expand Down

0 comments on commit 2f1a32e

Please sign in to comment.