Skip to content

Instantly share code, notes, and snippets.

@adampats
Created February 26, 2016 23:48
Show Gist options
  • Save adampats/987c5bb48d5d11d8bc5e to your computer and use it in GitHub Desktop.
Save adampats/987c5bb48d5d11d8bc5e to your computer and use it in GitHub Desktop.
function to get docker registry versions
# 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