Skip to content

Instantly share code, notes, and snippets.

@tianon
Last active August 29, 2015 14:09
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 tianon/a464abd2b1c5a994bdb7 to your computer and use it in GitHub Desktop.
Save tianon/a464abd2b1c5a994bdb7 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
image='alunduil/roundcube'
tag='latest'
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 }')"
imageId="$(curl -sSL -H "Authorization: Token $token" "https://registry-1.docker.io/v1/repositories/$image/tags/$tag")"
echo "${imageId//\"/}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment