Azure Container Registry - Quick Start Guide

March 2018 · 4 minute read

Azure Container Registry is the Microsoft equivalent to private Dockerhub repositories. First, I will show you how to quickly push an image to Azure Container Registry. In a second step, I will cover how to manage your registries and repositories using the PowerShell cmdlet AzureRM as well as the Azure CLI.

Quick start

To push a docker image to Azure Container Registry, first go to your Azure Container Registry service in the Azure portal.

In the ‘Overview’ section you can find a field called ‘Login server’. Jot down this address.

In a next step, login to your registry with:

docker login your-login-server-address-here

You will see a command prompt asking you for user name and password. You can find your access credentials under ‘Settings/Access Keys’.

Managing images

Every container registry contains 1:n repositories that are used to group container images together (e.g. by project).

Repositories are defined by using slashes / as follows:

your-login-server-address-here/target_image[:TAG] is a top-level image

your-login-server-address-here/project_name/target_image[:TAG] is a project specific image

your-login-server-address-here/project_name/sub_project/target_image[:TAG] is an image in a sub-project of the main project

You can view all your images by navigating to your registry in the Azure Portal and clicking on the ‘Repository’ tab. You can also start containers directly from there.

Connecting with ActiveDirectory and PowerShell

On Windows using Powershell is probably one of the easiest and most powerful ways to manage your Azure resources (including the container registry).

You can install the AzureRm cmdlet to manage your container registry. AzureRm is primarily focused on managing Azure services from a sysadmin perspective and provides mainly functions to create and change Azures services. I have not yet found a way to e.g. delete repositories in an Azure registry or list all repositories in a given registry. A more powerful solution is the Azure CLI (see next section).

The preferred method to install the cmdlet is to use PowerShellGet and pull it directly from the PowerShell Gallery. So first, we need to check if PowerShellGet is available:

Connecting using Active Directory and Azure CLI

You can also use the Azure CLI tool in Powershell to manage your repository (and Azure resources more generally). You can check if Azure CLI is installed by running:

az --version

If you do not have Azure CLI already installed, download it and run the installer. You might have to add C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin to your path so that Powershell finds the cmdlet.

First, we need to connect to our Azure account:

az login

Follow the instructions in your console to login. If you get an SSL error check if your are using self-signed certificates.

You can find an overview of the functionality provided by Azure CLI here. A few commands I find quite useful are provided below. Please be careful to check if you operate on an entire registry or on repositories in a registry!

az acr list -g your_resource_group -o table to list all container services in a table for a specific resource group