I'm really missing something here... I have created a Web API in VS2019, with Docker support. I have a Dockerfile in this project, and I have Published to a docker "container registry" in Azure. I've also created a Docker Resource Group, to contain this container registry. This all works fine... but what now ? How do I get Azure to actually run the Web API from this container ? Surely after getting VS2019 to create the registry for you, there would be some hint about what to do next...
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for the feedback! We are currently investigating and will update you shortly.
@MikeInSwitzerland not sure I fully understand the confusion. The last step in the tutorial is to run the image from the container
https://docs.microsoft.com/en-gb/azure/container-registry/container-registry-quickstart-task-cli#run-the-image
Is that not what you are looking for?
I will go ahead and close this out. If you have further questions just let me know and we can always reopen and continue the discussion.
The piece I'm missing is this: Â I've created a basic Web API using VS2019 with Docker support enabled. Â I've written my code, used the Publish command, and it's created a Container registry for this Web API, which I can see in my Azure Portal.
But... what now ? Â
I have the "path" of this registry, something like "mikeswebapi12345678.azurecr.io"
In the VS2019 "Publish" page, this value is called the "Repository", in Azure, it's called the "Login server".
I guess my next step is to build an image, using the syntax you described:
az acr build --image mikeswebapi/firstattempt:v1 --registry https://mikeswebapi12345678.azurecr.io --file Dockerfile .
But this throws 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've Google'd this error, and have tried following suggestions, first, making sure that I am logged in to the correct subscription
az account set --subscription 12341234-1234-1234-1234-1234567890
az login
...and then trying to register this...
az provider register -n Microsoft.ContainerRegistry
But the error doesn't go away:
C:\Users\mikeg\source\repos\MikesBank>az acr build --image mikeswebapi/firstattempt:v1 --registry https://mikeswebapi12345678.azurecr.io --file Dockerfile .
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've Google'd, I've tried every suggestion I can find, but no luck.
What am I missing ?
@MikeInSwitzerland are you running this off a companies corpnet by chance? There might be a firewall issue blocking the connection. If that is the case, I suggest trying while connected to a different network to see if it works.
Nope, running it at home, on my personal laptop, with my own Azure subscription.
Got it. I will run through the doc and see if it works for me. Will update shortly.
Ah okay try this
az acr build --image mikeswebapi/firstattempt:v1 --registry mikeswebapi12345678 --file Dockerfile .
@MikeInSwitzerland - Just adding to @MicahMcKittrick-MSFT 's suggestions. The above az acr build command looks like the correct syntax to build and push an image to ACR. But if I understand correctly, you've already built and published the image to ACR using other tools, and you now want to run a container using the image?
For a simple container you want to validate, you can use the az acr run command as shown in that article. You can also docker run the image from your registry, by authenticating to the registry and using the Docker CLI from your computer (example). For your scenario, you could also consider a serverless solution like Azure Container Instances to deploy your container. See this article for an example of deploying to ACI from ACR. Does this help?
@MikeInSwitzerland any update on this?
I will go ahead and close this. If you are still seeing issues let us know and we can reopen and continue.