Mike Gledhill
Mike Gledhill

Reputation: 29151

Running an Azure Docker container registry, created by VS2019

I'm sorry... seriously, I have Google'd this to death, but I'm still lost.

Using Visual Studio 2019, I created a project (with Docker support enabled), built myself a simple Web API, and published it to my Azure subscription. I logged into Azure, and could see this new Container Registry entry. Wonderful.

My problem: I can't work out how to run it, in Azure.

The simplest way, of course, is to create an Azure "Container Instance".

This is easy enough...

enter image description here

My problem is that when I create this instance, I just get an error of:

The image 'mikesbank20190xxxxxxxxx.azurecr.io' in container 
group 'mikescontainer' is not accessible. 
Please check the image and registry credential.

What am I missing ?

I assume that I've got the "image name" value wrong (shown above with my pointy finger) as the tooltip for "Image name" says:

The URI or Docker Hub tag of the public or private image. ... For other images the container registry should be included (for example: "myacr.azurecr.io/mycontainer:latest").

I have tried this. My image is called "mikesbank", the tag is "latest", so I tried changing it to the following, but this caused the same error:

mikesbank201909xxxxxxxx.azurecr.io/mikesbank:latest

This is a container in the same Subscription as the Container Registry. I'm not sure what else to check.

I did also try connecting to it from my laptop.

az account set --subscription 12341234-1234-1234-1234-1234567890
az login
C:\Users\mikeg\source\repos\MikesBank>az acr build --image mikeswebapi/firstattempt:v1 --registry https://mikeswebapi12345678.azurecr.io/mikesbank:latest --file Dockerfile .

... but this just threw an error of....

The resource with name 'https://mikeswebapi12345678.azurecr.io' and type 'Microsoft.ContainerRegistry/registries' could not be found in subscription 'Pay-As-You-Go (12341234-1234-1234-1234-1234567890)'.

I went off, Google'd this error, and was told to try this:

az provider register -n Microsoft.ContainerRegistry

...but it made absolutely no difference. Same error, again.

I'm sorry... I'm sure this is something really simple and dumb that I've missed, but I've given up Googling... can anyone help ?

Update

Just to add to Alex AIT's excellent answer (below) as StackOverflow doesn't allow me to add images when I reply to his answer:

Apparently, the simplest way to create a container from a Container Registry is to click on Repositories, the name of your repository, the name of your tag, then the "..." button. In the popup window, you can then choose "Run instance".

enter image description here

At the time of writing, apart from being well-hidden, this option isn't particularly smart. If you've created a Container Registry which Azure says will run on "windows / amd64", it will still happily suggest that you create a container for Linux (which will fail).

And even worse, Azure doesn't actually show you the cause of the error if something goes wrong, it just tells you:

enter image description here

To find the cause, you need to click on the icon in the top-right of Azure to open a Powershell window, and run:

az group deployment operation list --resource-group <YourResourceGroup> --name Microsoft.ContainerInstance

This will now show you the cause of the problem.

enter image description here

Why the hell doesn't Azure display this for us ? I love Azure, and all the good stuff they provide to us... but this is one area where it seriously needs improving.

Upvotes: 1

Views: 1192

Answers (1)

Alex
Alex

Reputation: 18526

You need to select Image type: private. This allows you to enter more values like username and password. You will get these values by opening the container registry created by Visual Studio. The reason is that your container registry is not public (unlike e.g. Docker Hub).

Private container registry source

It is even easier to run your image by starting in your container registry. You can select your image there and start a new container instance.

https://learn.microsoft.com/en-us/azure/container-instances/container-instances-using-azure-container-registry#deploy-with-azure-portal

Container Registry

Image Creation

Upvotes: 1

Related Questions