SandOfTime
SandOfTime

Reputation: 814

What is the difference between "docker images ls" and "docker image ls"?

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

Answers (2)

Max
Max

Reputation: 1877

Well, yes, confusing :)

Upvotes: 7

Mukesh Jha
Mukesh Jha

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

Related Questions