2. Set up Azure Container registry

In this step, you set up a suitable container registry for your app image. Container-capable hosting services like Azure App Service can then pull images from your registry.

This tutorial uses Azure Container Registry, a private, secure, hosted registry for your images. However, the tools and processes shown here also work with other registries like Docker Hub.

Create an Azure container registry

  1. In Visual Studio Code, select F1 or CTRL+SHIFT+P to open the command palette.

  2. Enter registry in the search box. From the results, select Azure Container Registry: Create Registry.

    Screenshot that shows searching for the term registry in Visual Studio Code Explorer.

  3. Enter or select the following values:

    Prompt Value
    Select Registry Provider Select Azure
    Registry name Enter a name that is unique in Azure and contains from 5 to 50 alphanumeric characters.
    SKU Basic
    Resource group Create a new resource group that is unique within your subscription. Create all remaining Azure resources in this resource group.
    Location Select a region close to you.

    Visual Studio Code creates the registry in Azure. After it finishes, you'll see a notification like the following one. This notification confirms the registry was successfully created.

    Confirmation in Visual Studio Code that the registry was created

  4. Open Docker Explorer. Ensure that the registry endpoint you just set up is visible under Registries.

    Verification that the registry appears in Docker Explorer

Sign in to Azure Container Registry

While you can see your Azure registries in the Docker extension, you can't push images to them until you sign in to Container Registry.

  1. In Visual Studio, select Ctrl+` to open the integrated terminal.

  2. Run the following Azure CLI command to sign in to Container Registry. Replace <your-registry-name> with the name of the registry you created.

    az acr login --name <your-registry-name>
    

Next steps