images: print hint when invoking "docker images" with ambiguous argument by thaJeztah · Pull Request #4849 · docker/cli (original) (raw)
- addresses / closes docker images list does not list any images #887
- addresses / closes Docker CLI images vs image #4591
- addresses / closes docker image list vs. docker images list is confusing moby/moby#47404
- related 4600-cli/command: adding docker volumes alias #4601
- related docker images is a great alias for docker image ls, while docker volumes does not exist #4600
- related feat: add 'docker containers' alias to match the 'docker images' logic #3758
cli/command/images: runImages: inline intermediate var
cli/command/images: runImages: use proper camel-case for dockerCLI
images: print hint when invoking "docker images" with ambiguous argument
The docker images
top-level subcommand predates the docker <object> <verb>
convention (e.g. docker image ls
), but accepts a positional argument to
search/filter images by name (globbing). It's common for users to accidentally
mistake these commands, and to use (e.g.) docker images ls
, expecting
to see all images, but ending up with an empty list because no image named
"ls" was found.
Disallowing these search-terms would be a breaking change, but we can print
and informational message to help the users correct their mistake.
Before this patch:
docker images ls
REPOSITORY TAG IMAGE ID CREATED SIZE
With this patch applied:
docker images ls
REPOSITORY TAG IMAGE ID CREATED SIZE
No images found matching "ls": did you mean "docker image ls"?
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)
print hint when invoking "docker images" with ambiguous argument