#!/bin/bash
# Prerequisite
# 1) Install curl, jq
token_name="mytokenname"
token_password="mytokenpassword"
repo="windows"
tag="ltsc2022"
registry="myregistry.azurecr.io"
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, */*"
scope="repository:$repo:pull"
acr_credential=$(echo -n "$token_name:$token_password" | base64 -w0)
acr_access_token=$(curl -H "Authorization: Basic $acr_credential" "https://$registry/oauth2/token?service=$registry&scope=$scope" | jq -r ".access_token")
configs=$(curl -H "Authorization: Bearer $acr_access_token" -H "$accept_header" https://$registry/v2/$repo/manifests/$tag | jq -r ".config.digest")
for config in $configs; do
echo "-----------------downloading config $config-------------------"
curl -L -H "Authorization: Bearer $acr_access_token" https://$registry/v2/$repo/blobs/$config | jq
done
Last active
December 23, 2022 20:48
-
-
Save northtyphoon/098cdc1ecc4d57bcf339ea73f9f60100 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