0
votes

I am currently working in a azure project where we need a way to push the image to public registries - it can be Azure ACR or docker registry.

Looks like Azure doesnt support anonymous read-access to Azure ACR. Hence only way is to push image to docker registry and pull the image form docker registry during container deployment in azure.

Is it possible? If so, how can I use azure template to achieve it? Any example please?

1

1 Answers

3
votes

I thinks it is possible to create the azure container by using imageRegistryCredentials property, you could refer to the sample template.

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

For more details, you could refer to this link.

enter image description here

If the image is public, the password is not required.

enter image description here