# Prerequisite
# 1) Install curl, jq
user_name="mytokenname" # it can be admin name, service principal client id or scopemap token name
user_password="mytokenpassword" # it can be admin password, service principal password or scopemap token password
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, */*"
acr_credential=$(echo -n "$user_name:$user_password" | base64 -w0)
acr_access_token=$(curl -H "Authorization: Basic $acr_credential" "https://$registry/oauth2/token?service=$registry&scope=$scope" | jq -r ".access_token")
curl -v -H "$accept_header" -H "Authorization: Bearer $acr_access_token" https://$registry/v2/$repo/manifests/$tag
Last active
January 31, 2023 03:10
-
-
Save northtyphoon/fb980529c3fad3c6cbb3f5f43d547413 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment