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:
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:
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.
Pingback: Hosting Docker images on Azure Container Registry - How to Code .NET
Pingback: Dew Drop - July 10, 2017 (#2516) - Morning Dew
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.
Thanks, I never used AD previously, thus I wasn’t even aware of this.
Great post. I found your website perfect for my needs. Very useful info specifically the last part. Thank you for sharing
This is the entire guide to the Azure Container Registers. I’ve been looking for teaching materials for a long time. Thank you Peter, for that simple thought, without complications. It’s easy for understanding.
excuse me, Piotr
Wonderfull keep sharing Awesome post really appreciating