feat(image): add --tree flag to image list - #5092
Open
ekalinin wants to merge 1 commit into
Open
Conversation
Add a tree view to `nerdctl images` compatible with `docker image ls --tree`: a top-level row per image and one child row per platform, with columns IMAGE, ID, DISK USAGE, CONTENT SIZE and IN USE. IN USE is derived from existing containers by matching (image name, platform). The tree view is incompatible with --quiet and --format. Per-platform rows now carry their own manifest digest as the ID instead of the shared index digest. Closes containerd#5005 Signed-off-by: Eugene Kalinin <e.v.kalinin@gmail.com>
AkihiroSuda
reviewed
Jul 22, 2026
| name string // familiar "repo:tag" or "<none>:<none>" | ||
| id string // target (index or manifest) digest, truncated unless --no-trunc | ||
| diskUsage int64 // sum of the platforms' unpacked snapshot sizes | ||
| blobSize int64 // sum of the platforms' content-store blob sizes |
Member
There was a problem hiding this comment.
Non-tree mode should use the new size definition too
So I suggest working on it before --tree
AkihiroSuda
reviewed
Jul 22, 2026
| Expected: func(data test.Data, helpers test.Helpers) *test.Expected { | ||
| return &test.Expected{ | ||
| Output: expect.All( | ||
| expect.Contains("IMAGE", "ID", "DISK USAGE", "CONTENT SIZE", "IN USE"), |
Member
There was a problem hiding this comment.
DISK USAGE and CONTENT SIZE should be tested.
The expected sizes should be defined in testutil.
AkihiroSuda
reviewed
Jul 22, 2026
| testCase := &test.Case{ | ||
| // `docker image ls --tree` is experimental and requires the containerd | ||
| // image store, so keep this test nerdctl-only. | ||
| Require: require.Not(nerdtest.Docker), |
Member
There was a problem hiding this comment.
the containerd image store is now enabled in Docker, so this test should not be skipped
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a tree view to
nerdctl imagescompatible withdocker image ls --tree: a top-level row per image and one child row per platform, with columns IMAGE, ID, DISK USAGE, CONTENT SIZE and IN USE.IN USE is derived from existing containers by matching (image name, platform). The tree view is incompatible with --quiet and --format. Per-platform rows now carry their own manifest digest as the ID instead of the shared index digest.
Closes #5005