通过REST使用Azure Container Registry中的图像

Hon*_*Ooi 1 rest azure docker azure-container-registry

有没有一种方法可以使用REST API在Azure容器注册表中操作图像(删除,重新标记等)?现有问题的答案仅提及CLI。

Hon*_*Ooi 5

答案是ACR实现了Docker Registry API,因此此处列出的所有命令也将适用于Azure注册表中的映像。这与Resource Manager REST接口不同,后者用于注册表本身的操作。

要进行身份验证,ACR文档中列出了各种选项,包括通过AAD或使用用户名/密码:https : //github.com/Azure/acr/blob/master/docs/AAD-OAuth.md

例如,这是脚本,AAD-OAuth.md用于列出注册表中的所有图像/存储库:

#!/bin/bash

export registry=" --- you have to fill this out --- "
export user=" --- you have to fill this out --- "
export password=" --- you have to fill this out --- "

export operation="/v2/_catalog"

export credentials=$(echo -n "$user:$password" | base64 -w 0)

export catalog=$(curl -s -H "Authorization: Basic $credentials" https://$registry$operation)
echo "Catalog"
echo $catalog
Run Code Online (Sandbox Code Playgroud)