Azure Container Registry (ACR) is a fully managed private Docker registry provided by Azure Cloud. In this section, we will create a new instance of ACR using the Azure CLI. You will learn how to achieve similar build automation as provided by Docker Hub but with the possibility of building Windows images and using a private registry.
You can find detailed installation instructions for the Azure CLI in Chapter 2, Managing State in Containers.
To create an Azure Container Registry instance, follow these steps:
Ensure that you are logged in to the Azure CLI by using the az login command in PowerShell. Proceed by creating a dedicated resource group for your ACR instance. In this example, we will use the acr-resource-group resource group and westeurope as the Azure location:
az group create ` --name acr-resource-group ` --location westeurope
Next, create a basic-tier ACR instance with a globally unique name (for demonstration purposes, we have provided handsonkubernetesonwinregistry, but you have to provide your own unique name as it will be a part of the registry's DNS name):
The most important information is "loginServer": "handsonkubernetesonwinregistry.azurecr.io", which will be used for pushing and pulling Docker images.
Finally, the last step is to log in to the registry so that you can use the registry in the Docker CLI:
az acr login ` --name handsonkubernetesonwinregistry
With ACR set up, we are ready to build a Docker image using ACR in the cloud environment.