Skip to content

Instantly share code, notes, and snippets.

@zawyelwin
Created February 24, 2021 05:10
Show Gist options
  • Save zawyelwin/5f9cfa41132780a4ba1c17c76f01ab39 to your computer and use it in GitHub Desktop.
Save zawyelwin/5f9cfa41132780a4ba1c17c76f01ab39 to your computer and use it in GitHub Desktop.
Script to import azure container registry images with tags to another azure container registry.
#!/bin/bash
registryName='<REGISTRY_NAME>'
repository=("apm/pinpoint-agent", "apm/pinpoint-collector")
sourceAcrName="<SOURCE_ACR_NAME>"
destAcrName="<DESTINATION_ACR_NAME>"
for repo in "${repository[@]}"
do
tags=$(az acr repository show-tags --name $sourceAcrName --repository $repo | xargs | tr -d '[]\n\r,' )
for i in $tags;
do
echo "Importing $repo:$i to $destAcrName from $sourceAcrName"
az acr import --name $destAcrName --source <SOURCE_ACR_URL>/$repo:$i --image $repo:$i
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment