Create a container registry using the Azure CLI

Azure Container Registry is a managed Docker container registry service used for storing private Docker container images. This guide details creating an Azure Container Registry instance using the Azure CLI.

This quickstart requires that you are running the Azure CLI version 2.0.21 or later. Run az --version to find the version. If you need to install or upgrade, see Install Azure CLI 2.0.

You must also have Docker installed locally. Docker provides packages that easily configure Docker on any Mac, Windows, or Linux system.

Create a resource group

Create a resource group with the az group create command. An Azure resource group is a logical container into which Azure resources are deployed and managed.

The following example creates a resource group named myResourceGroup in the eastus location.

az group create --name myResourceGroup --location eastus

Create a container registry

In this quickstart, we create a Basic registry. Azure Container Registry is available in several different SKUs, described briefly in the following table. For extended details on each, see Container registry SKUs.

SKU Description
Basic A cost-optimized entry point for developers learning about Azure Container Registry. Basic registries have the same programmatic capabilities as Standard and Premium (Azure Active Directory authentication integration, image deletion, and web hooks), however, there are size and usage constraints.
Standard The Standard registry offers the same capabilities as Basic, but with increased storage limits and image throughput. Standard registries should satisfy the needs of most production scenarios.
Premium Premium registries have higher limits on constraints, such as storage and concurrent operations, including enhanced storage capabilities to support high-volume scenarios. In addition to higher image throughput capacity, Premium adds features like geo-replication for managing a single registry across multiple regions, maintaining a network-close registry to each deployment.

Create an ACR instance using the az acr create command.

The name of the registry must be unique. In the following example myContainerRegistry007 is used. Update this to a unique value.

az acr create --resource-group myResourceGroup --name myContainerRegistry007 --sku Basic

When the registry is created, the output is similar to the following:

  "adminUserEnabled": false,
  "creationDate": "2017-09-08T22:32:13.175925+00:00",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myContainerRegistry007",
  "location": "eastus",
  "loginServer": "",
  "name": "myContainerRegistry007",
  "provisioningState": "Succeeded",
  "resourceGroup": "myResourceGroup",
  "sku": {
    "name": "Basic",
    "tier": "Basic"
  "status": null,
  "storageAccount": null,
  "tags": {},
  "type": "Microsoft.ContainerRegistry/registries"

Throughout the rest of this quickstart, we use <acrName> as a placeholder for the container registry name.

Log in to ACR

Before pushing and pulling container images, you must log in to the ACR instance. To do so, use the az acr login command.

az acr login --name <acrName>

The command returns a Login Succeeded message once completed.

Push image to ACR

To push an image to an Azure Container registry, you must first have an image. If you don't yet have any local container images, run the following command to pull an existing image from Docker Hub.

docker pull microsoft/aci-helloworld

Before you can push an image to your registry, you must tag it with the fully qualified name of your ACR login server. Run the following command to obtain the full login server name of the ACR instance.

az acr list --resource-group myResourceGroup --query "[].{acrLoginServer:loginServer}" --output table

Tag the image using the docker tag command. Replace <acrLoginServer> with the login server name of your ACR instance.

docker tag microsoft/aci-helloworld <acrLoginServer>/aci-helloworld:v1

Finally, use docker push to push the image to the ACR instance. Replace <acrLoginServer> with the login server name of your ACR instance.

docker push <acrLoginServer>/aci-helloworld:v1

List container images

The following example lists the repositories in a registry:

az acr repository list --name <acrName> --output table



The following example lists the tags on the aci-helloworld repository.

az acr repository show-tags --name <acrName> --repository aci-helloworld --output table



Clean up resources

When no longer needed, you can use the az group delete command to remove the resource group, ACR instance, and all container images.

az group delete --name myResourceGroup

Next steps

In this quickstart, you created an Azure Container Registry with the Azure CLI. If you would like to use Azure Container Registry with Azure Container Instances, continue to the Azure Container Instances tutorial.