Hosting Docker images on Azure Container Registry

Hosting Docker images on Azure Container Registry

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.

Create a new Azure Container Registry.

Create a new Azure Container Registry.

Make sure you enable admin access.

Make sure you enable admin access.

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.

Details of the login server, username and password.

Details of the login server, username and password.

Copy these 3 and start your terminal:

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:

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.

4 Comments Hosting Docker images on Azure Container Registry

  1. Pingback: Hosting Docker images on Azure Container Registry - How to Code .NET

  2. Pingback: Dew Drop - July 10, 2017 (#2516) - Morning Dew

  3. Łukasz

    I would change one thing. You shouldn’t use admin user, instead of use Azure Active Directory service principal. In normal use of this service, admin user should remain disabled.

    Reply

Leave A Comment

Your email address will not be published. Required fields are marked *