cli/command/image: Fix total content size calculation in image tree

Before this patch, image total content size would only include
container images content size.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2025-04-11 13:28:33 +02:00
parent e2865628ae
commit 1a950db5ce
No known key found for this signature in database
GPG Key ID: B85EFCFE26DEF92A

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.