Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to list tags of Docker image on remote registry

📅 2019-Aug-23 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

There is no Docker command that can be used to retrieve and list all the tags of a Docker image on a remote Docker registry. This would be useful, for example, to list all the tags of a given Docker image from the Docker Hub registry.

Docker Hub enables the retrieval of the list of all tags of a given repository (or image) using the HTTP GET command from this URL: This information will be in the JSON format. A JSON parser like jq can be used to retrieve the tag names from this JSON.

Putting all this together, we can create a command to list all the tags of a repository named repo1/foobar2 from Docker Hub:

$ wget -q -O - | jq -r .[].name

If you do not have jq, it can be installed easily:

$ sudo apt install jq

The above command can be easily turned into a shell script that accepts a repository (or image) name as input and list its tags from the Docker Hub.

Tried with: Docker 18.09.6 and Ubuntu 18.04