dockerdocker-imagedocker-tag

How can I find a Docker image with a specific tag in Docker registry on the Docker command line?


I try to locate one specific tag for a Docker image. How can I do it on the command line? I want to avoid downloading all the images and then removing the unneeded ones.

In the official Ubuntu release, https://registry.hub.docker.com/_/ubuntu/, there are several tags (release for it), while when I search it on the command line,

user@ubuntu:~$ docker search ubuntu | grep ^ubuntu
ubuntu              Official Ubuntu base image                          354
ubuntu-upstart      Upstart is an event-based replacement for ...   7
ubuntufan/ping                                                0
ubuntu-debootstrap                                                   0

Also in the help of command line search https://docs.docker.com/engine/reference/commandline/search/, no clue how it can work?

Is it possible in the docker search command?

If I use a raw command to search via the Docker registry API, then the information can be fetched:

   $ curl https://registry.hub.docker.com//v1/repositories/ubuntu/tags | python -mjson.tool
   [
    {
        "layer": "ef83896b",
        "name": "latest"
    },
    .....
    {
        "layer": "463ff6be",
        "name": "raring"
    },
    {
        "layer": "195eb90b",
        "name": "saucy"
    },
    {
        "layer": "ef83896b",
        "name": "trusty"
    }
]

Solution

  • As far as I know, the CLI does not allow searching/listing tags in a repository.

    But if you know which tag you want, you can pull that explicitly by adding a colon and the image name: docker pull ubuntu:saucy