cli icon indicating copy to clipboard operation
cli copied to clipboard

The new `docker images' output format is pretty unusable

Open mbert opened this issue 1 month ago • 12 comments

Description

First of all: there's lots of legacy code relying on the old output. Hence changing this in such a way really a bad idea - even though having told pretty much everybody that for parsable output --format should be used. There real old code out there.

But even worse: the new output format truncates image names so that grepping for image names always requires --no-trunc which is really inconvenient.

Reproduce

docker images Output: lots of truncated image names that aren't readable.

Expected behavior

docker images should default to output that is useful for most cases.

docker version

Client: Docker Engine - Community
 Version:           29.0.0
 API version:       1.52
 Go version:        go1.25.4
 Git commit:        3d4129b
 Built:             Mon Nov 10 21:49:15 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.0.0
  API version:      1.52 (minimum version 1.44)
  Go version:       go1.25.4
  Git commit:       d105562
  Built:            Mon Nov 10 21:45:58 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.1.5
  GitCommit:        fcd43222d6b07379a4be9786bda52438f0dd16a1
 runc:
  Version:          1.3.3
  GitCommit:        v1.3.3-0-gd842d771
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    29.0.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.29.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.40.3
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 3
  Running: 0
  Paused: 0
  Stopped: 3
 Images: 274
 Server Version: 29.0.0
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: fcd43222d6b07379a4be9786bda52438f0dd16a1
 runc version: v1.3.3-0-gd842d771
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.17.7-300.fc43.x86_64
 Operating System: Fedora Linux 43 (Workstation Edition)
 OSType: linux
 Architecture: x86_64
 CPUs: 32
 Total Memory: 125.4GiB
 Name: ...
 ID: 8609766b-6859-4c6d-b799-973d7216c328
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: mdietze
 Experimental: false
 Insecure Registries:
...
  ::1/128
  127.0.0.0/8
 Registry Mirrors:
  https://mirror.gcr.io/
 Live Restore Enabled: false
 Firewall Backend: iptables+firewalld

Additional Info

No response

mbert avatar Nov 12 '25 16:11 mbert

Description

First of all: there's lots of legacy code relying on the old output. Hence changing this in such a way really a bad idea - even though having told pretty much everybody that for parsable output --format should be used. There real old code out there.

But even worse: the new output format truncates image names so that grepping for image names always requires --no-trunc which is really inconvenient.

Reproduce

docker images Output: lots of truncated image names that aren't readable.

Expected behavior

docker images should default to output that is useful for most cases.

See this https://github.com/docker/cli/discussions/6651

jarbelix avatar Nov 13 '25 00:11 jarbelix

Thanks for reporting!

But even worse: the new output format truncates image names so that grepping for image names always requires --no-trunc which is really inconvenient.

In the default case the names are truncated to fit the terminal, but when the stdout is redirected to a non-terminal the width can't be determined and falls back to 80.

I've opened a PR to disable the name truncation when the output is redirected: https://github.com/docker/cli/pull/6656

vvoland avatar Nov 13 '25 11:11 vvoland

I would also add that regardless of the intent, disabling grep for quick checks is a poor experience. The image is on my machine when I run docker image ls But when I try to grep I get told write a much longer command.

Image

docker version

Client: Docker Engine - Community
 Version:           29.0.0
 API version:       1.52
 Go version:        go1.25.4
 Git commit:        3d4129b
 Built:             Mon Nov 10 21:46:03 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.0.0
  API version:      1.52 (minimum version 1.44)
  Go version:       go1.25.4
  Git commit:       d105562
  Built:            Mon Nov 10 21:46:03 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.1.5
  GitCommit:        fcd43222d6b07379a4be9786bda52438f0dd16a1
 runc:
  Version:          1.3.3
  GitCommit:        v1.3.3-0-gd842d771
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

jaykae avatar Nov 13 '25 19:11 jaykae

@jaykae this is fixed with: https://github.com/docker/cli/pull/6656 We'll be releasing 29.0.1 soon that will include this fix.

vvoland avatar Nov 13 '25 20:11 vvoland

@jaykae this is fixed with: #6656 We'll be releasing 29.0.1 soon that will include this fix.

Thank you, that will help. Still one more remark / suggestion. While I think that this change should never had been made (because there is lots of legacy code relying on the old output, and this will break it), I think the idea of truncating long image names at the end rather questionable, because the end is what you are normally most interested to see.

If an image name is too long this is most likely caused by a long prefix / server part. Hence if image names get too long I'd like to propose removing characters and adding an ellipsis ("...") near the beginning in such cases, say, after the 5th position or so. In that case the actual image name and tag will still remain readable in most cases.

mbert avatar Nov 14 '25 12:11 mbert

+1 @mbert , I am not sure if changing the format of docker images was a good idea. I'm pretty sure a lot of scripts use that output and will break

cruizba avatar Nov 15 '25 01:11 cruizba

Agree, this is a pretty impacting change. I also see it's buggy, with the ability to pin the format desired being unstable (#6663). Apparently it also hides images that were previously shown unless passed a flag, which is super bad in my opinion. I'm not sure the intent of these changes, but from a user perspective it's changing things in breaking ways that have been stable for years.

Be very careful with this kind of change. I view this like rearranging the controls on a car, or rearranging someone's bathroom in the middle of the night. It's annoying at best, and definitely unwelcome when waking up in the middle of night and realizing slightly too late that the toilet isn't where it was yesterday. Changes to the user interface are highly visible, and probably not welcomed by a significant set of users. Please be deliberate in what's changed, advertise it well, and test it very thoroughly. My $0.02 as a long-time user.

ag-TJNII avatar Nov 21 '25 15:11 ag-TJNII

Thank you, we highly value your input!

I can see why the name truncation is indeed a bad UX and I've opened a PR to remove it: https://github.com/docker/cli/pull/6675

I hope this makes it now possible to keep compatibility with the output while still experiencing the new view.

Long-term we want to make some UX changes to the overall CLI experience - this is especially important with the transition to the containerd image store which brings proper multi-platform support and enables us to work on further improvements of the Engine.

Of course it's still important for us to not break existing users and keep the CLI as backwards compatible as we can. Most CLI operations have the --format option that allows you to be explicit about that (and also makes the parsing easier for you!).

vvoland avatar Nov 24 '25 16:11 vvoland

+1 @mbert , I am not sure if changing the format of docker images was a good idea. I'm pretty sure a lot of scripts use that output and will break

Can confirm, our docker images ... | grep -q ... snippet in one of our scripts broke (not gracefully).

benma avatar Dec 01 '25 14:12 benma

@benma is it still the case with v29.1.1? Which part of the output did you script depend on?

vvoland avatar Dec 01 '25 14:12 vvoland

@benma is it still the case with v29.1.1? Which part of the output did you script depend on?

Yes, see https://github.com/BitBoxSwiss/bitbox02-firmware/pull/1702/files. We grepped for image_name\ *tag to check for presence, but that fails because in the new default output, the tag is not in a separate column anymore.

The fix is easy enough, but a bit bothersome that there was a breaking change.

Off-topic, but I also thought the CREATED column was useful, but that column seems to be gone now in the default view.

benma avatar Dec 01 '25 14:12 benma

I agree, CREATED was super useful for me too. CONTENT SIZE and EXTRA however, are not.

Not sure why the default was changed instead of using --format for the new output if that's what Docker wants to transition to.

nmarley avatar Dec 05 '25 23:12 nmarley

I’m adding a comment to save a few minutes for anyone who might need it. It’s possible to obtain the same output format as the old version by using this command: docker image ls -a --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedSince}}\t{{.Size}}"

gasparetto avatar Dec 22 '25 14:12 gasparetto

@gasparetto Also docker images --no-trunc works for me well - to get a list of images by the "created" date descending.

mirao avatar Dec 22 '25 19:12 mirao