skip to Main Content

I want to list all images with the tag foo, regardless of repository name.

What I’ve tried:

docker images  --filter=reference='*:foo'

With the following images on the daemon:

x/y/z:foo
y/z:foo
z:foo

.. the above command will list only the z:foo image.

I cannot find anywhere documented how the Docker CLI interprets these wildcards. I’ve found other answers, where people state that you generally need to look into the Go code for that (?!). For example, in order to realize that the * wildcard will not match the / character. As long as it is not documented, I guess it is urban legend, although I can reproduce it.

In any case, I’ll restate the question:

How to list all images on docker daemon with tag name foo, regardless of repository name.

2

Answers


  1. You can always pipe output to other tools, like awk:

    docker images | awk '$2 == "foo"'
    
    x/y/z     foo            f1329e1a30c0   5 weeks ago    691MB
    y/z       foo            180697b5c4fb   6 weeks ago    1.39GB
    z         foo            2ee88e314807   6 weeks ago    1.51GB
    
    Login or Signup to reply.
  2. @Justinas has already given a good answer, but to elaborate on the docker images --filter=reference wildcard, it does not match /, but if you really want to use it you can use multiple filters:

    docker images --filter=reference="*:foo" --filter=reference="*/*:foo" --filter=reference="*/*/*:foo"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search