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
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmetb/421ca0ef345721069d27 to your computer and use it in GitHub Desktop.
Save ahmetb/421ca0ef345721069d27 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
image='tianon/speedtest'
layer='b31651d7665036bcf58a0b6b0d7aca173daff87b003ec50621cb0fde8d68864f'
# docker inspect b31651d7665036bcf58a0b6b0d7aca173daff87b003ec50621cb0fde8d68864f | grep '"Size"'
# "Size": 580580561,
# ("Content-Length: 228991341" though...)
token="$(curl -sSL -o /dev/null -D- -H 'X-Docker-Token: true' "https://index.docker.io/v1/repositories/$image/images" | awk -F ':[[:space:]]*|\r' '$1 == "X-Docker-Token" { print $2 }')"
curl -sSL -o /dev/null -D- -H "Authorization: Token $token" "https://registry-1.docker.io/v1/images/$layer/layer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment