![](/img/trans.png)
[英]Azure Storage Rest-API via Powershell to list container content
[英]Working with images in Azure Container Registry via REST
答案是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
这是一些有关如何使用Node.js获取图像列表的示例代码:
const httpreq = require('httpreq');
const server = '<get it from the Azure portal>';
const username = '<get it from the Azure portal>';
const password = '<get it from the Azure portal>';
httpreq.get(`https://${server}/v2/_catalog`, {
auth: `${username}:${password}`
}, (err, res) => {
if(err) return console.log(err);
var data = JSON.parse(res.body);
console.log(data);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.