In one of the previous videos, as well as posts I described how to use Docker and Docker Hub in order to build and deploy applications written with ASP.NET Core. In this post, I’d like to introduce the Azure Container Registry which is an alternative to the well-known Docker Hub.





In order to start with Azure Container Registry, you need to have the account on Azure portal (and some credits, as it’s not for free although it’s a very cheap service). Once you login to the portal, you can create a new resource of type: Azure Container Registry – just provide a unique name, select the resource group, region and basically that’s it – after a minute or two, you’ll have your container registry ready to use. Ensure that you enable the admin access mode.

When you open your newly created resource, navigate to the Access keys section.

Here, you will the so-called login server (which is the actual URL such as myapp.azurecr.io, username and password.

Copy these 3 and start your terminal:

docker login [login_server] -u [username] -p [password] 1 docker login [ login_server ] - u [ username ] - p [ password ]

You can also just type docker login [login_server] and you shall be prompted to provide the username and password. Once completed, you should see Login succeeded! message. From that point on, you can push, pull and do other things with your Docker images. Let’s say that you’d like to push the local image named my-api. At first, you have to tag it correctly, only then the Docker image can be transferred further to the remote repository:

docker tag my-api myapp.azurecr.io/my-api docker push 1 2 docker tag my - api myapp . azurecr . io / my - api docker push

And that’s it. You can make use of this container registry just like you used (or not) Docker Hub. Keep in mind though that these repositories are private by default, which means that you have to perform authentication first.