Skip to content

Instantly share code, notes, and snippets.

@mbentley
Created August 27, 2019 16:40
Show Gist options
  • Save mbentley/ae75c38bdb2201274f6907b7f183669f to your computer and use it in GitHub Desktop.
Save mbentley/ae75c38bdb2201274f6907b7f183669f to your computer and use it in GitHub Desktop.
#!/bin/sh
IMAGE="${1:-}"
TAG="${2:-}"
if [ -z "${IMAGE}" ]
then
echo "Missing IMAGE"
echo "Usage: ${0} namespace/repo tag"
exit 1
fi
if [ -z "${TAG}" ]
then
echo "Missing TAG"
echo "Usage: ${0} namespace/repo tag"
exit 1
fi
curl -s \
-H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" \
-H "Authorization: Bearer $(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:${IMAGE}:pull,push" | jq -r .token)" \
"https://registry.hub.docker.com/v2/${IMAGE}/manifests/${TAG}" \
| jq .
$ ./get_hub_manifest.sh library/nginx latest
{
"manifests": [
{
"digest": "sha256:099019968725f0fc12c4b69b289a347ae74cc56da0f0ef56e8eb8e0134fc7911",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "amd64",
"os": "linux"
},
"size": 948
},
{
"digest": "sha256:e5e4a3e39e58dc4c40064c9433740e7c2031516375c201aab26649dcfa2c7a6d",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "arm",
"os": "linux",
"variant": "v7"
},
"size": 948
},
{
"digest": "sha256:83712aa5ba1a5a9ad7d1d230560a0229e3a962c40754483f86c2e82c9239cd06",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "arm64",
"os": "linux",
"variant": "v8"
},
"size": 948
},
{
"digest": "sha256:07a8c4f6df9dea75fb37fbc08348d6abb820328911e5536ce4ca8475e08d7a35",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "386",
"os": "linux"
},
"size": 948
},
{
"digest": "sha256:b79ba2582b8b3a81aba6e57ad068ebaeb675c44bf25737a3e767d99ca1cb414a",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "ppc64le",
"os": "linux"
},
"size": 948
},
{
"digest": "sha256:69e12814dcae07a6a1095b2d26d4bac5b2b09966d230cf6a0b972843116a8347",
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"platform": {
"architecture": "s390x",
"os": "linux"
},
"size": 948
}
],
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"schemaVersion": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment