Create an Azure Container Registry using PowerShell

In this article

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 PowerShell, pushing a container image into the registry and finally deploying the container from your registry into Azure Container Instances (ACI).

This quickstart requires the Azure PowerShell module version 3.6 or later. Run Get-Module -ListAvailable AzureRM to find the version. If you need to install or upgrade, see Install Azure PowerShell module.

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

Log in to Azure

Log in to your Azure subscription with the Login-AzureRmAccount command and follow the on-screen directions.

Login-AzureRmAccount

Create resource group

Create an Azure resource group with New-AzureRmResourceGroup. A resource group is a logical container into which Azure resources are deployed and managed.

The command returns Login Succeeded once completed. You might also see a security warning recommending the use of the --password-stdin parameter. While its use is outside the scope of this article, we recommend following this best practice. See the docker login command reference for more information.

Push image to ACR

To push an image to an Azure Container registry, you must first have an image. If needed, run the following command to pull a pre-created image from Docker Hub.

docker pull microsoft/aci-helloworld

The image must be tagged with the ACR login server name. Use the docker tag command to do this.

You should get an initial response back from Azure Resource Manager with details on your container. To monitor the status of your container and check to see when it is running repeat the Get-AzureRmContainerGroup command. It should take less than a minute.

To see the running application, navigate to the public IP address in your favorite browser. It should look something like this:

Clean up resources

When no longer needed, you can use the Remove-AzureRmResourceGroup command to remove the resource group, Azure Container Registry, and all Azure Container Instances.

Remove-AzureRmResourceGroup -Name myResourceGroup

Next steps

In this quickstart, you created an Azure Container Registry with the Azure CLI, and launched an instance of it in Azure Container Instances. Continue to the Azure Container Instances tutorial for a deeper look at ACI.