Skip to content

[Request]: Calculate/Include Full Size in JSON Output of images. #860

Description

@theetherGit

Feature or enhancement request details

Right now I'm not sure it should be a bug or request.

Currently, in json format we have descriptor details and there is no full image size in json format while in table format we have calculated full image size in size field.

  • List images with verbose flag
container image ls -v

output:
Image

  • List images with json format
container image ls --format json

output:
Image

[
  {
    "reference": "docker.io/library/alpine:latest",
    "descriptor": {
      "digest": "sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412",
      "mediaType": "application/vnd.oci.image.index.v1+json",
      "size": 9218
    }
  },
  {
    "reference": "docker.io/library/postgres:latest",
    "descriptor": {
      "digest": "sha256:41fc5342eefba6cc2ccda736aaf034bbbb7c3df0fdb81516eba1ba33f360162c",
      "mediaType": "application/vnd.oci.image.index.v1+json",
      "size": 10229
    }
  },
  {
    "reference": "ghcr.io/apple/containerization/vminit:0.8.1",
    "descriptor": {
      "mediaType": "application/vnd.oci.image.index.v1+json",
      "size": 306,
      "digest": "sha256:666991717c0d26a211b400b09ad45ac84a9f64af8a08c2c64a54884e76d98954"
    }
  },
  {
    "reference": "ghcr.io/apple/containerization/vminit:0.9.1",
    "descriptor": {
      "size": 306,
      "mediaType": "application/vnd.oci.image.index.v1+json",
      "digest": "sha256:6839bd6e230281df328571bd15929f8115303cba19737f3d888cc77a113e482d"
    }
  }
]

In json format, we get size from the descriptor instead of sum of sizes from descriptor , layers and manifest config.

Code reference for how size of image is calculated in table format: https://github.com/apple/container/blob/main/Sources/ContainerCommands/Image/ImageList.swift#L83-L84

Expected:
In json format of images we should have full image size:

{
    "reference": "ghcr.io/apple/containerization/vminit:0.9.1",
    "size": "172.5 MB"
    "descriptor": {
      "size": 306,
      "mediaType": "application/vnd.oci.image.index.v1+json",
      "digest": "sha256:6839bd6e230281df328571bd15929f8115303cba19737f3d888cc77a113e482d"
    },
  }

Docker cli do provide same size for image in table and json format.

Image

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added this to the 2026-01 milestone on Jan 27, 2026
  2. added a commit that references this issue on Jan 28, 2026
    3abf81f
  3. added a commit that references this issue on Feb 4, 2026
    8b79ec5
  4. added a commit that references this issue on Feb 18, 2026
    61c0378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions