Skip to content

Instantly share code, notes, and snippets.

@alejovicu
Created January 12, 2024 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alejovicu/70a2aae3692a0220e164855530e943a5 to your computer and use it in GitHub Desktop.
Save alejovicu/70a2aae3692a0220e164855530e943a5 to your computer and use it in GitHub Desktop.
Get tags for an image in docker hub
#!/usr/bin/env bash
if [ $# -lt 1 ]
then
cat << HELP
dockertags -- list all tags for a Docker image on a remote registry.
Example:
- If there is no repo use "library":
dockertags library/ubuntu
- If it has a repo and image:
dockertags alejovicu/git-sync
HELP
fi
image="$1"
tags=`wget -q "https://registry.hub.docker.com/v2/repositories/${image}/tags?page_size=1024" -O - | jq -r '.results[] | .name'`
echo "${tags}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment