我目前正在一个azure项目中工作,我们需要一种方法将图像推送到公共注册表 - 它可以是Azure ACR或docker注册表。
看起来Azure不支持对Azure ACR的匿名读取访问。因此,唯一的方法是将图像推送到docker注册表,并在azure中的容器部署期间从docker注册表中提取图像。
有可能吗?如果是这样,我如何使用azure模板来实现它?有什么例子吗?
答案 0 :(得分:3)
我认为可以使用imageRegistryCredentials
属性创建azure容器,您可以参考示例模板。
{
"name": "string",
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2018-04-01",
"location": "string",
"tags": {},
"properties": {
"containers": [
{
"name": "string",
"properties": {
"image": "string",
"command": [
"string"
],
"ports": [
{
"protocol": "string",
"port": "integer"
}
],
"environmentVariables": [
{
"name": "string",
"value": "string"
}
],
"resources": {
"requests": {
"memoryInGB": "number",
"cpu": "number"
},
"limits": {
"memoryInGB": "number",
"cpu": "number"
}
},
"volumeMounts": [
{
"name": "string",
"mountPath": "string",
"readOnly": boolean
}
]
}
}
],
"imageRegistryCredentials": [
{
"server": "string",
"username": "string",
"password": "string"
}
],
"restartPolicy": "string",
"ipAddress": {
"ports": [
{
"protocol": "string",
"port": "integer"
}
],
"type": "Public",
"ip": "string",
"dnsNameLabel": "string"
},
"osType": "string",
"volumes": [
{
"name": "string",
"azureFile": {
"shareName": "string",
"readOnly": boolean,
"storageAccountName": "string",
"storageAccountKey": "string"
},
"emptyDir": {},
"secret": {},
"gitRepo": {
"directory": "string",
"repository": "string",
"revision": "string"
}
}
]
}
}
有关详细信息,请参阅此link。
如果图片公开,则不需要密码。