Azure Container image pull from private docker hub registry not working

Lukas Bickel 0 Reputation points
2023-02-06T07:51:39.3266667+00:00

My deployment suddenly stopped working. It was fine for multiple months but now suddenly fails to pull the image from my private dockerhub registry
I'm getting the following error

{
  "code": "DeploymentFailed",
  "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
  "details": [
    {
      "code": "InaccessibleImage",
      "message": "The image 'consolidatesoftware/kowalski:a3f38b6be70573d7aa67e84a343be249f0009335' in container group 'consolidate-staging' is not accessible. Please check the image and registry credential."
    }
  ]
}

My template sepcifies the ImageRegistryCredentials correctly and pulling the image with those credentials from the commandline works perfectly

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "name": {
        "defaultValue": "consolidate",
        "type": "string"
      },
      "container-image": {
        "defaultValue": "consolidatesoftware/kowalski:latest",
        "type": "string"
      },
      "dockerhub-username": {
        "type": "securestring"
      },
      "dockerhub-password": {
        "type": "securestring"
      }
    },
    "variables": {
      "location": "[resourceGroup().location]"
    },
    "resources": [
      {
        "type": "Microsoft.ContainerInstance/containerGroups",
        "apiVersion": "2021-10-01",
        "name": "[parameters('name')]",
        "location": "[variables('location')]",
        "properties": {
          "sku": "Standard",
          "containers": [
            {
              "name": "[parameters('name')]",
              "properties": {
                "image": "[parameters('container-image')]",
                "resources": {
                  "requests": {
                    "memoryInGB": 1.5,
                    "cpu": 1
                  }
                }
              }
            }
          ],
          "imageRegistryCredentials": [
            {
              "server": "index.docker.io",
              "username": "[parameters('dockerhub-username')]",
              "password": "[parameters('dockerhub-password')]"
            }
          ],
          "restartPolicy": "OnFailure",
          "osType": "Linux"
        }
      }
    ],
    "outputs": {
      "hostname": {
        "type": "string",
        "value": "[reference(resourceId('Microsoft.ContainerInstance/containerGroups', parameters('name'))).ipAddress.fqdn]"
      }
    }
  }
  
Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
757 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Abdul Sajid Mohammed 470 Reputation points Microsoft Employee
    2023-02-06T21:56:34.5966667+00:00

    Hello Lukas,

    The error message "InaccessibleImage" indicates that the deployment failed because the specified container image is not accessible. This can happen for a few reasons, such as: image name or registry URL is incorrect, image doesn't exist in the registry, or the registry credentials are incorrect or don't have access to the image.

    From your deployment error i your image tag is not latest compared to your local pull image tag, is this expected?

    "message": "The image 'consolidatesoftware/kowalski:a3f38b6be70573d7aa67e84a343be249f0009335'

    Your local pull image tag: "defaultValue": "consolidatesoftware/kowalski:latest",

    Please verify if the image tag you specified exists in your repository.

    Best Regards.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.