Created
February 26, 2016 23:48
-
-
Save adampats/987c5bb48d5d11d8bc5e to your computer and use it in GitHub Desktop.
function to get docker registry versions
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
# Dump all docker registry image versions | |
docker_reg_image_versions () { | |
if [ -z $1 ]; then | |
echo "Pass registry hostname as argument." | |
else | |
reg="$1" | |
read -p "$reg username: " user | |
read -s -p "$reg password: " pass | |
echo "" | |
for i in $(curl -k -s -X GET "https://$reg/v2/_catalog" \ | |
-u "$user:$pass" -H "Accept: application/json" | \ | |
jq '.|.repositories[]' | cut -d'"' -f2); do | |
curl -k -s -X GET "https://$reg/v2/$i/tags/list" \ | |
-u "$user:$pass" | jq . | |
done | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment