Last active
March 10, 2017 17:46
-
-
Save rtfpessoa/67d50b340195d4e37777ddac9781127a to your computer and use it in GitHub Desktop.
Simple Docker Registry API v2 Wrapper
This file contains 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
#!/usr/bin/env bash | |
# | |
# Simple Docker Registry API v2 Wrapper | |
# | |
REPOSITORY="doplicated/client" | |
get_from_dh() { | |
URL="$1" | |
TOKEN="$(curl 'https://auth.docker.io/token?service=registry.docker.io&scope=repository:'$REPOSITORY':pull' 2>/dev/null | jq -r '.token')" | |
curl -H "Authorization: Bearer ${TOKEN}" "$URL" 2>/dev/null | |
} | |
rm -f latest.log other.log same.log | |
get_from_dh 'https://index.docker.io/v2/doplicated/client/manifests/latest' | jq '.fsLayers' > latest.log | |
get_from_dh 'https://index.docker.io/v2/doplicated/client/manifests/2.40.0' | jq '.fsLayers' > same.log | |
get_from_dh 'https://index.docker.io/v2/doplicated/client/manifests/2.42.0' | jq '.fsLayers' > other.log | |
echo "" | |
echo "Same" | |
git diff --no-index latest.log same.log | |
echo "" | |
echo "Other" | |
git diff --no-index latest.log other.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment