Created
March 18, 2018 10:30
-
-
Save sujaypillai/364267c56aab1adca045e9bb7f0dd21b to your computer and use it in GitHub Desktop.
list all tags for a image from repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/28320134/how-to-list-all-tags-for-a-docker-image-on-a-remote-registry