Docker – How to list all tags for a Docker image on a remote registry


How can I list all tags of a Docker image on a remote Docker registry using the CLI (preferred) or curl?

Preferably without pulling all versions from the remote registry. I just want to list the tags.

Best Answer

Update: sadly this solution will no longer work because Docker has deprecated the v1 API.

I got the answer from here . Thanks a lot! :)

Just one-line-script:(find all the tags of debian)

wget -q -O -  | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n'  | awk -F: '{print $3}'

UPDATE Thanks for @degelf's advice. Here is the shell script.


if [ $# -lt 1 ]
cat << HELP

dockertags  --  list all tags for a Docker image on a remote registry.

    - list all tags for ubuntu:
       dockertags ubuntu

    - list all php tags containing apache:
       dockertags php apache


tags=`wget -q${image}/tags -O -  | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n'  | awk -F: '{print $3}'`

if [ -n "$2" ]
    tags=` echo "${tags}" | grep "$2" `

echo "${tags}"

You can just create a new file name, dockertags, under /usr/local/bin (or add a PATH env to your .bashrc/.zshrc), and put that code in it. Then add the executable permissions(chmod +x dockertags).


dockertags ubuntu ---> list all tags of ubuntu

dockertags php apache ---> list all php tags php containing 'apache'

Related Question