如何从docker注册表中提取容器映像以部署azure容器

如何从docker注册表中提取容器映像以部署azure容器,azure,docker,azure-template,azure-container-registry,Azure,Docker,Azure Template,Azure Container Registry,我目前正在一个azure项目中工作,我们需要一种将映像推送到公共注册表的方法-它可以是azure ACR或docker注册表 Azure似乎不支持对Azure ACR的匿名读取访问。因此,唯一的方法是将映像推送到docker注册表,并在azure中的容器部署期间从docker注册表中提取映像 可能吗?如果是,我如何使用azure模板来实现它?请举个例子?我认为可以使用imageRegistryCredentials属性创建azure容器,您可以参考示例模板 { "name": "string

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

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


可能吗?如果是,我如何使用azure模板来实现它?请举个例子?

我认为可以使用
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"
        }
      }
    ]
  }
}
有关更多详细信息,请参阅此

如果图像是公开的,则不需要密码


我认为可以使用
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"
        }
      }
    ]
  }
}
有关更多详细信息,请参阅此

如果图像是公开的,则不需要密码


如何公开图像?@Foreverleer我认为你的问题超出了帖子主题,这里有一个供你参考的问题,如果我的回答有帮助,你可以将其标记为答案,关闭它,并在另一篇帖子中询问docker的用法。非常感谢。:-)你如何公开形象?@ForeverLearner我认为你的问题超出了帖子主题,这里有一个供你参考的问题,如果我的回答有帮助,你可以将其标记为答案,关闭它,并在另一篇帖子中询问docker的用法。非常感谢。:-)