Microsoft Azure – Container Registry For Deploying .NET Core Apps
In this article, we will learn about how to use Azure Container Registry to run a .NET Core App Azure Container Registry is a place where you can store your container images securely. Let’s deploy a container image to it and see how we can use it. To follow along, we’ll need to Visual Studio and Docker Desktop.
Follow the below steps to use the Azure container registry for deploying .NET core Apps
Step 1: In Visual Studio, we’ve created a new .Net Core Console App. It’s very simple and only outputs “Hello World” to the console.
Step 2: Let’s add Docker supports to it, and choose a “Linux”. Now, it has a Docker file that describes the container image for the app.
Step 3: Let’s publish this to an Azure Container Registry. First, we choose Azure and the Azure Container Registry, that’s it.
Step 4: We’ll choose an existing Azure container Registry. We can also create a new one if we like, and finish and now publish it.
In the Azure Container Registry. We can store many container images here and use lots of features like tasks that automate deployment and patching of the images.
Step 5: Let’s go to the Repositories menu. Here, is the tag of the image that we’ve just published. Now from here, we can deploy and run this container image to a web app or to a container instance.
Step 6: Let’s do the last one. We just need to enter a name and we’ll leave the rest as it is. This creates an Azure Container Instance, which is perfect for running a single container.
Step 7: In the Azure Container Instance. Let’s see its containers here. It has been busy with our container. Let’s see. Here in the logs, we can see the output of the console app that now runs in a container in the Container Instance.
The Azure Container Registry is a managed and safe place to store our container images that provides features like geo-replication and an easy way to run our containers in Azure Container Instances.