Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I list all tags for a Docker image on a remote registry?

Tags:

docker

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.

like image 660
Johan Avatar asked Feb 04 '15 11:02

Johan


People also ask

How do I see all docker tags?

The most recent version of docker-tags can be found in my GitHubGist : "List Docker Image Tags using bash". The docker-tags function has a dependency on jq. If you're playing with JSON, you likely already have it.

Which command is used to show all docker images?

The easiest way to list Docker images is to use the “docker images” with no arguments. When using this command, you will be presented with the complete list of Docker images on your system. Alternatively, you can use the “docker image” command with the “ls” argument.

Can docker registry contains collection of images?

Show activity on this post. A Docker image registry is the place to store all your Docker images. The image registry allows you to push and pull the container images as needed. Registries can be private or public.


1 Answers

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

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

wget -q https://registry.hub.docker.com/v1/repositories/debian/tags -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.

#!/bin/bash  if [ $# -lt 1 ] then cat << HELP  dockertags  --  list all tags for a Docker image on a remote registry.  EXAMPLE:      - list all tags for ubuntu:        dockertags ubuntu      - list all php tags containing apache:        dockertags php apache  HELP fi  image="$1" tags=`wget -q https://registry.hub.docker.com/v1/repositories/${image}/tags -O -  | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n'  | awk -F: '{print $3}'`  if [ -n "$2" ] then     tags=` echo "${tags}" | grep "$2" ` fi  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).

Usage:

dockertags ubuntu ---> list all tags of ubuntu

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

like image 138
Vi.Ci Avatar answered Oct 20 '22 04:10

Vi.Ci