Skip to content

Latest commit

 

History

History
103 lines (69 loc) · 5.15 KB

container-registry-get-started-powershell.md

File metadata and controls

103 lines (69 loc) · 5.15 KB
title description ms.date ms.topic ms.custom
Quickstart - Create registry - PowerShell
Quickly learn to create a private Docker registry in Azure Container Registry with PowerShell
06/03/2021
quickstart
devx-track-azurepowershell, mvc, mode-api

Quickstart: Create a private container registry using Azure PowerShell

Azure Container Registry is a private registry service for building, storing, and managing container images and related artifacts. In this quickstart, you create an Azure container registry instance with Azure PowerShell. Then, use Docker commands to push a container image into the registry, and finally pull and run the image from your registry.

Prerequisites

[!INCLUDE updated-for-az]

This quickstart requires Azure PowerShell module. Run Get-Module -ListAvailable Az to determine your installed version. If you need to install or upgrade, see Install Azure PowerShell module.

You must also have Docker installed locally. Docker provides packages for macOS, Windows, and Linux systems.

Because the Azure Cloud Shell doesn't include all required Docker components (the dockerd daemon), you can't use the Cloud Shell for this quickstart.

Sign in to Azure

Sign in to your Azure subscription with the Connect-AzAccount command, and follow the on-screen directions.

Connect-AzAccount

Create resource group

Once you're authenticated with Azure, create a resource group with New-AzResourceGroup. A resource group is a logical container in which you deploy and manage your Azure resources.

New-AzResourceGroup -Name myResourceGroup -Location EastUS

Create container registry

Next, create a container registry in your new resource group with the New-AzContainerRegistry command.

The registry name must be unique within Azure, and contain 5-50 alphanumeric characters. The following example creates a registry named "myContainerRegistry007." Replace myContainerRegistry007 in the following command, then run it to create the registry:

$registry = New-AzContainerRegistry -ResourceGroupName "myResourceGroup" -Name "myContainerRegistry007" -EnableAdminUser -Sku Basic

[!INCLUDE container-registry-quickstart-sku]

Log in to registry

Before pushing and pulling container images, you must log in to your registry with the Connect-AzContainerRegistry cmdlet. The following example uses the same credentials you logged in with when authenticating to Azure with the Connect-AzAccount cmdlet.

Note

In the following example, the value of $registry.Name is the resource name, not the fully qualified registry name.

Connect-AzContainerRegistry -Name $registry.Name

The command returns Login Succeeded once completed.

[!INCLUDE container-registry-quickstart-docker-push]

[!INCLUDE container-registry-quickstart-docker-pull]

Clean up resources

Once you're done working with the resources you created in this quickstart, use the Remove-AzResourceGroup command to remove the resource group, the container registry, and the container images stored there:

Remove-AzResourceGroup -Name myResourceGroup

Next steps

In this quickstart, you created an Azure Container Registry with Azure PowerShell, pushed a container image, and pulled and ran the image from the registry. Continue to the Azure Container Registry tutorials for a deeper look at ACR.

[!div class="nextstepaction"] Azure Container Registry tutorials

[!div class="nextstepaction"] Azure Container Registry Tasks tutorials