Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c8d/list: Fix shared size calculation #47597

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion daemon/containerd/image_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,13 @@ func (i *ImageService) imageSummary(ctx context.Context, img images.Image, platf

target := img.Target()

chainIDs, err := img.RootFS(ctx)
diffIDs, err := img.RootFS(ctx)
if err != nil {
return err
}

chainIDs := identity.ChainIDs(diffIDs)

ts, _, err := i.singlePlatformSize(ctx, img)
if err != nil {
return err
Expand Down Expand Up @@ -650,6 +652,11 @@ func computeSharedSize(chainIDs []digest.Digest, layers map[digest.Digest]int, s
}
size, err := sizeFn(chainID)
if err != nil {
// Several images might share the same layer and neither of them
// might be unpacked (for example if it's a non-host platform).
if cerrdefs.IsNotFound(err) {
continue
}
return 0, err
}
sharedSize += size
Expand Down