Skip to content

Instantly share code, notes, and snippets.

@ahmetb
Forked from tianon/speedtest-registry-directly.sh
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save ahmetb/af912cc764ec2c2ce45c to your computer and use it in GitHub Desktop.

Select an option

Save ahmetb/af912cc764ec2c2ce45c to your computer and use it in GitHub Desktop.
CREDS=XXXX:YYYYY
VICTIM=tianon/speedtest
LAYER=b31651d7665036bcf58a0b6b0d7aca173daff87b003ec50621cb0fde8d68864f
# LAYER=80da4fde3cb0d72261fcf67a713a016105dee9667cbc228c6973523c09681bf3
SIGNATURE="`curl -iv -o/dev/null --basic -u $CREDS -H "X-Docker-Token: true" "https://registry.hub.docker.com/v1/repositories/$VICTIM/images" 2>&1 | awk '{print $3}' | grep signature | tr -d "\r\n"`"
CF_URL="`curl -iv -o/dev/null -H "Authorization: Token $SIGNATURE" https://registry-1.docker.io/v1/images/$LAYER/layer 2>&1 | awk '{print $3}' | grep cloudfront | sed -e 's/\r\n//g' | tr -d "\r\n"`"
echo "Going to fetch: $CF_URL"
time curl -iv -o/dev/null "${CF_URL}" 2>&1 | grep -wi "content-length\|x-cache"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment