You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running image size -n {image} you get total size of all layer in all tags . This counts each of the layers toward total size. Most images include base layers in each of the images thus do not need to be counted for each tag.
tag v1.0
layer: xyz
layer: abc
tag v1.1
layer: xyz
layer : cdf
Sum should be xyz + abc + cdf ( not xyz + abc + xyz + cdf )
I propose to pull out the sizeInfo to the outside loop and only count distinct layer to toward total image size.
sizeInfo := make(map[string]int64)
for _, tag := range tags {
manifest, err := r.ImageManifest(imgName, tag)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
for _, layer := range manifest.Layers {
sizeInfo[layer.Digest] = layer.Size
}
}
for _, size := range sizeInfo {
totalSize += size
}
fmt.Printf("%d %s\n", totalSize, imgName)
The text was updated successfully, but these errors were encountered:
When running image size -n {image} you get total size of all layer in all tags . This counts each of the layers toward total size. Most images include base layers in each of the images thus do not need to be counted for each tag.
tag v1.0
layer: xyz
layer: abc
tag v1.1
layer: xyz
layer : cdf
Sum should be xyz + abc + cdf ( not xyz + abc + xyz + cdf )
I propose to pull out the sizeInfo to the outside loop and only count distinct layer to toward total image size.
The text was updated successfully, but these errors were encountered: