0

我目前在一个 azure 项目中工作,我们需要一种将图像推送到公共注册表的方法——它可以是 Azure ACR 或 docker 注册表。

看起来 Azure 不支持对 Azure ACR 的匿名读取访问。因此,唯一的方法是在 azure 中的容器部署期间将映像推送到 docker 注册表并从 docker 注册表中提取映像。

可能吗?如果是这样,我该如何使用 azure 模板来实现呢?请问有什么例子吗?

4

1 回答 1

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"
        }
      }
    ]
  }
}

有关更多详细信息,您可以参考此链接

在此处输入图像描述

如果图像是public,则不需要密码。

在此处输入图像描述

于 2018-05-31T07:19:07.883 回答