Looking up docker image tags

This recipe is to check the tags defined for a specific Docker image in docker.hub.

The basic API is at https://registry.hub.docker.com/v2

So the format is as follows:

https://registry.hub.docker.com/v2/repositories/{namespace}/{image}/tags/

Where:

  • namespace : usually is the user account posting the image. For official images set the namespace to library.
  • image : Image name.

Examples:

So, you can then use curl and jq to access the relevant data. For example, to get the tags, last updated time and digest as a tsv:

curl -s -L $URL | jq -r '(.results[] | select(.tag_status == "active") | [.name, .last_updated
, .digest]) | @tsv'

v1 API

You could also use the v1 API while it is still available:

https://registry.hub.docker.com/api/content/v1/repositories/public/{namespace}/{image}/tags/