Microsoft Azure – Container Registration for App Deployment
In this article, we will learn 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, you’ll need the following:
- Visual Studio
- Docker Desktop.
Here in Visual Studio, we’ve created a new .Net Core Console App. It’s very simple and only outputs “Hello World” to the console.
Let’s add Docker supports to it by right-clicking the mouse and choosing “Linux”.
Now, it has a Docker file that describes the container image for the app as shown below:
Now let’s publish this to an Azure Container Registry.
Then, we choose Azure followed by the Azure Container Registry.
Here we’ll choose an existing one. You can also create a new one if you like, and finish and publish it.
The below image shows 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.
Let’s go to the Repositories menu. This 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.
Then 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. The below image shows the Azure Container Instance.
We can also view the logs of 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 your container images that provides features like geo-replication and an easy way to run your containers in Azure Container Instances.