Cli: docker images list does not list any images

Created on 19 Feb 2018  ยท  8Comments  ยท  Source: docker/cli

Description
docker image list provides me with a list of images, e.g.:

$ docker image list
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
simple-graphql      latest              86b0df65e859        16 seconds ago      231MB
<none>              <none>              689940be3277        45 minutes ago      231MB
<none>              <none>              99be4d0ea751        About an hour ago   231MB
node                slim                04ab59975cba        43 hours ago        231MB
hello-world         latest              f2a91732366c        3 months ago        1.85kB
training/webapp     latest              6fae60ef3446        2 years ago         349MB

However, when running docker images list (which, as far as I know, should be an alias for docker image list, I get only the headers:

$ docker images list
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

I would expect these two to be the same; or is there an actual difference between docker image and docker images?

Output of docker version:

Docker version 18.02.0-ce, build fc4de447b5

Output of docker info:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 10
Server Version: 18.02.0-ce
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 23
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.4.115-boot2docker
Operating System: Boot2Docker 18.02.0-ce (TCL 8.2.1); HEAD : 99245f4 - Thu Feb  8 17:43:39 UTC 2018
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 995.9MiB
Name: default
ID: DWHU:76V2:7I3N:6DLZ:EK7E:XRYJ:BASW:IHDV:EXA4:7RLJ:TU4P:GCKV
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
 provider=virtualbox
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.):
Using Docker Toolbox on Windows 10 (i.e. running docker in VirtualBox)

kinquestion

Most helpful comment

@itilitymaarten thanks for the issue, but it's working as designed.

docker images list is not an alias to docker image list, docker images is. When calling docker images list, it's the same as docker image list list or docker image list --filter=reference=list, which means filtering the image list with reference that are equal to list โ€” and as you don't have any images containing list, it's returning an empty list ๐Ÿ˜‰

All 8 comments

@itilitymaarten thanks for the issue, but it's working as designed.

docker images list is not an alias to docker image list, docker images is. When calling docker images list, it's the same as docker image list list or docker image list --filter=reference=list, which means filtering the image list with reference that are equal to list โ€” and as you don't have any images containing list, it's returning an empty list ๐Ÿ˜‰

I see, thanks for clarifying, and sorry for opening an issue about this. I assume this is a general pattern docker cli, e.g. docker containers is an alias for docker container list?

No, there's no docker containers subcommand.

Originally there was docker images (listing images), docker rmi (remove image), docker ps (listing running containers), and docker rm (remove container); new commands were added to be more consistent (docker <something> ls/list for listing objects, docker <something> remove/rm for _removing_ objects).

So while those old commands are still around, generally, the docker <something> <command> form is the preferred command; old aliases are kept around for backward compatibility.

You can set the DOCKER_HIDE_LEGACY_COMMANDS environment variable (see https://github.com/docker/cli/blob/master/docs/reference/commandline/cli.md) to hide the old commands.

There are _some_ commands that will still be shown; docker run and docker build, because those are one of the most used commands, and thus won't be hidden.

Could it be a good idea to display a deprecation warning for commands like docker images? The documentation you linked already states that the commands might be removed in a future release, sounds like deprecated to me :)

Either way, thanks for your help!

I think the Jury was still out on that ๐Ÿ˜…; hiding by default is an option still being discussed, but deprecating is a bit more involved (as is printing a warning, as it may be a change in behaviour for people)

I understand changing the tool itself might be a bit too much for now, but could it at least be put on the documentation page? (https://docs.docker.com/engine/reference/commandline/images/)

I can imagine changing the tool's output might interfere with scripts or something, but a documentation page for humans wouldn't be bothered by such problems I imagine :)

Either way, feel free to close this issue if nothing more is going to happen :)

Hello, Disabling SElinux solved the issue for me. Use the following command line : setenforce 0 then check with getenforce (It should display Permissive).
cheers

The documentation page of the "new & preferred" syntax is almost empty https://docs.docker.com/engine/reference/commandline/image_ls/

The documentation page of the "old & can be hidden" syntax is the one with the full explanation and lot of examples
https://docs.docker.com/engine/reference/commandline/images/

And nowhere on these pages it is mentioned that one syntax is an alias of the other one.

==> all doc should be transferred to /image_ls page
==> doc in /images page should become a link to the other one specifying that "images" is an old syntax that can be hidden

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thaJeztah picture thaJeztah  ยท  3Comments

dnephin picture dnephin  ยท  3Comments

johanneswuerbach picture johanneswuerbach  ยท  4Comments

dpyro picture dpyro  ยท  4Comments

Ingosmar89219 picture Ingosmar89219  ยท  3Comments