Merge pull request #6000 from vvoland/image-tree-totalcontent

cli/command/image: Fix total content size calculation in image tree
This commit is contained in:
Sebastiaan van Stijn 2025-04-11 13:45:35 +02:00 committed by GitHub
commit c718d3f13c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,6 +54,8 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
var totalContent int64
children := make([]subImage, 0, len(img.Manifests))
for _, im := range img.Manifests {
totalContent += im.Size.Content
if im.Kind == imagetypes.ManifestKindAttestation {
attested[im.AttestationData.For] = true
continue
@ -78,7 +80,6 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
details.InUse = true
}
totalContent += im.Size.Content
children = append(children, sub)
// Add extra spacing between images if there's at least one entry with children.