feat(image): adopt Docker v29 output for images list - #5093
Conversation
21a312d to
97dbfbd
Compare
97dbfbd to
a22cd95
Compare
Make the default `nerdctl images` output match Docker v29: a collapsed view with IMAGE, ID, DISK USAGE, CONTENT SIZE and EXTRA columns, an "In Use" (U) indicator, and <untagged> for dangling images. Multi-platform images are collapsed into a single row with aggregated disk and content size. Like Docker, the "In Use" legend is only printed when the output is a terminal, so piped and redirected output stays clean, and rows are ordered by image reference with untagged images last rather than by creation time. In-use is resolved by image target digest, the way Docker matches containers to images, so every reference to a used target is flagged, not only the one the container was created from. The new view is used only for the bare command. Passing --format, --quiet, --no-trunc, --digests or --names falls back to the legacy table (REPOSITORY, TAG, IMAGE ID, CREATED, PLATFORM, SIZE, BLOB SIZE), so existing scripts and templates keep working, including their creation-time ordering. This mirrors Docker's own shouldUseTree fallback. Since the default output now matches Docker, the images tests also run against the Docker target; only the nerdctl-specific --names subtest stays gated. Tests that assert on the default `images` output for untagged images (image prune/remove and build-without-tag) are updated to expect <untagged>. The expanded per-platform `--tree` view is left for a follow-up. Closes containerd#5027 Signed-off-by: Eugene Kalinin <e.v.kalinin@gmail.com>
a22cd95 to
4dc5675
Compare
|
Force-pushed. Both threads above are addressed ( 1. "In Use" is now resolved by image target digest instead of image name moby matches containers to images by digest ( if c.ImageManifest != nil && c.ImageManifest.Digest == target.Digest {nerdctl was keying the in-use set on 2. Row ordering in the new view now follows docker/cli docker/cli's tree view sorts by image name lexicographically and places untagged images last, while nerdctl kept its creation-time ordering. The new view is now sorted by the rendered One known divergence left, which I'd rather fix separately - let me know if you want it here
So nerdctl can over-report for partially pulled images - which is not exotic here, given the lazy-pulling snapshotters (stargz, nydus, SOCI, overlaybd) - and under-report when attestations are present. This math predates this PR (it is the same code behind today's PTAL. |
Make the default
nerdctl imagesoutput match Docker v29: a collapsed view withIMAGE,ID,DISK USAGE,CONTENT SIZEandEXTRAcolumns, an "In Use" (U)indicator, and
<untagged>for dangling images. Multi-platform images are collapsedinto a single row with aggregated disk and content size.
Details that follow Docker's behavior:
DISK USAGEis the content store blobs plus the unpacked snapshots (Docker'sTotal),CONTENT SIZEis the blobs alone. Both are formatted with 3 significantdigits, like Docker.
images, so every reference to a used target is flagged, not only the one the
container was created from.
redirected output stays clean.
creation time.
IDcolumn is the OCI digest of the image target, which matches Docker's IDwith the containerd image store (it differs only from the legacy graphdriver
image ID). The help text and docs are updated accordingly.
The new view is used only for the bare command. Passing
--format,--quiet,--no-trunc,--digestsor--namesfalls back to the legacy table (REPOSITORY,TAG,IMAGE ID,CREATED,PLATFORM,SIZE,BLOB SIZE), so existing scripts andtemplates keep working, including their creation-time ordering. This mirrors Docker's
own
shouldUseTreefallback.Since the default output now matches Docker, the images tests also run against the
Docker target; only the nerdctl-specific
--namessubtest stays gated. Tests thatassert on the default
imagesoutput for untagged images (image prune/remove andbuild-without-tag) are updated to expect
<untagged>.The expanded per-platform
--treeview is left for a follow-up.Closes #5027