Reputation: 814
What is the difference between docker images ls
and docker image ls
(with and without s (plural form))?
I'm confused about these two commands in Docker. docker images ls
is listing images in docker, what is the purpose of docker image ls
command?
Check the docs:
Upvotes: 26
Views: 10399
Reputation: 1877
docker image ls
lists imagesdocker images xyz
lists images with the name xyz
. So you usually get empty list for a docker images ls
, because ls
is treated as name. By the way, we can use a wildcard docker images postgr*
. Reference: https://docs.docker.com/engine/reference/commandline/images/#list-images-by-name-and-tagWell, yes, confusing :)
Upvotes: 7
Reputation: 934
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. (Read this github discussion by vdemeester and many more https://github.com/docker/cli/issues/887 )
However, when you do docker images image_name
, what it does is, it returns all the parameters(list) of image image_name
i.e.
REPOSITORY TAG IMAGE ID CREATED SIZE
Earlier you were trying to have docker images ls
which means docker image ls ls
and the second ls is a list and not an image. Hence if you do docker images
it will list down all the images which means it is docker image ls
or docker image list
. I hope this makes it clear.
Upvotes: 28