# Prerequisite
# 1) Install azure-cli, curl, jq
repo="hello-world"
tag="latest"
registry="myregistry.azurecr.io"
scope="repository:$repo:pull"
accept_header="Accept: application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json, application/vnd.cncf.oras.artifact.manifest.v1+json, */*"
az acr update --name $registry --anonymous-pull-enabled
acr_access_token=$(curl "https://$registry/oauth2/token?service=$registry&scope=$scope" | jq -r ".access_token")
# alternative post request
# acr_access_token=$(curl -v -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=password&service=$registry&scope=$scope" "https://$registry/oauth2/token" | jq -r ".access_token")
curl -v -H "$accept_header" -H "Authorization: Bearer $acr_access_token" https://$registry/v2/$repo/manifests/$tag | jq
# Prerequisite
# 1) Install curl, jq
accept_header="Accept: application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json,*/*"
registry_realm="https://auth.docker.io/token"
registry_service="registry.docker.io"
registry="registry.hub.docker.com"
repo="library/hello-world"
tag="latest"
scope="repository:$repo:pull"
access_token=$(curl "$registry_realm?service=$registry_service&scope=$scope" | jq -r ".access_token")
curl -v -H "$accept_header" -H "Authorization: Bearer $access_token" https://$registry/v2/$repo/manifests/$tag | jq