Last active
January 24, 2017 21:36
-
-
Save dmcgowan/dcf36d3f2c71857c7df6841114b7cdc8 to your computer and use it in GitHub Desktop.
Script to fetch image configurations from hub
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
#!/bin/sh | |
if [ "$#" -ne 2 ]; then | |
echo "Wrong arguments, expect: <name> <tag>" | |
fi | |
IMAGE=$1 | |
TAG=$2 | |
TOKEN=$(curl -s "https://auth.docker.io/token?scope=repository:$IMAGE:pull&service=registry.docker.io" | jq -r .token) | |
CONFIG_DIGEST=$(curl -s -H"Accept: application/vnd.docker.distribution.manifest.v2+json" -H"Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/$IMAGE/manifests/$TAG" | jq -r .config.digest) | |
CONFIG=$(curl -sL -H"Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/$IMAGE/blobs/$CONFIG_DIGEST") | |
echo $CONFIG | jq '.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment