mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
Fix containerd image count
Ensure image count returned by containerd image service only includes the count of unique images. Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
@@ -98,7 +98,15 @@ func (i *ImageService) CountImages(ctx context.Context) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
return len(imgs)
|
||||
uniqueImages := map[digest.Digest]struct{}{}
|
||||
for _, i := range imgs {
|
||||
dgst := i.Target().Digest
|
||||
if _, ok := uniqueImages[dgst]; !ok {
|
||||
uniqueImages[dgst] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
return len(uniqueImages)
|
||||
}
|
||||
|
||||
// LayerStoreStatus returns the status for each layer store
|
||||
|
||||
Reference in New Issue
Block a user