Skip to content

Latest commit

 

History

History
108 lines (74 loc) · 5.9 KB

hosting-web-apps-in-docker.md

File metadata and controls

108 lines (74 loc) · 5.9 KB
title description author manager ms.devlang ms.topic ms.subservice ms.date ms.author
Deploy ASP.NET Docker app to Container Registry
Use Visual Studio Container Tools to deploy a containerized ASP.NET or ASP.NET Core web app to Azure Container Registry.
ghogen
mijacobs
dotnet
how-to
container-tools
10/27/2021
ghogen

Deploy an ASP.NET container to a container registry using Visual Studio

Docker is a lightweight container engine, similar in some ways to a virtual machine, which you can use to host applications and services. This tutorial walks you through using Visual Studio to publish your containerized application to an Azure Container Registry.

If you don't have an Azure subscription, create a free account before you begin.

Prerequisites

To complete this tutorial:

::: moniker range="vs-2019"

Create an ASP.NET Core web app

The following steps guide you through creating a basic ASP.NET Core app that will be used in this tutorial. If you already have a project, you can skip this section.

::: moniker range="vs-2019" [!INCLUDE create-aspnet5-app] ::: moniker-end :::moniker range=">=vs-2022" [!INCLUDE create-aspnet5-app] ::: moniker-end

::: moniker range="vs-2019"

Publish your container to Azure Container Registry

  1. Right-click your project in Solution Explorer and choose Publish.

  2. On the Publish dialog, select Docker Container Registry.

    Screenshot of Publish dialog - choose Docker Container Registry.

  3. Choose Create New Azure Container Registry.

    Screenshot of Publish dialog - choose Create New Azure container registry.

  4. Fill in your desired values in the Azure Container Registry screen.

    Setting Suggested value Description
    DNS Prefix Globally unique name Name that uniquely identifies your container registry.
    Subscription Choose your subscription The Azure subscription to use.
    Resource Group myResourceGroup Name of the resource group in which to create your container registry. Choose New to create a new resource group.
    SKU Standard Service tier of the container registry
    Registry Location A location close to you Choose a Location in a region near you or near other services that will use your container registry.

    Screenshot of Visual Studio's create Azure Container Registry dialog.

  5. Click Create.

  6. Choose Finish to complete the process. ::: moniker-end

::: moniker range=">=vs-2022"

Publish your container to Azure Container Registry

  1. Right-click your project in Solution Explorer and choose Publish.

  2. On the Publish dialog, select Docker Container Registry.

    Screenshot of Publish dialog - choose Docker Container Registry.

  3. Choose Create New Azure Container Registry.

    Screenshot of Publish dialog - choose Create New Azure container registry.

  4. Fill in your desired values in the Azure Container Registry screen.

    Setting Suggested value Description
    DNS Prefix Globally unique name Name that uniquely identifies your container registry.
    Subscription Choose your subscription The Azure subscription to use.
    Resource Group myResourceGroup Name of the resource group in which to create your container registry. Choose New to create a new resource group.
    SKU Standard Service tier of the container registry
    Registry Location A location close to you Choose a Location in a region near you or near other services that will use your container registry.

    Screenshot of Visual Studio's create Azure Container Registry dialog.

  5. Click Create.

  6. Choose Finish to complete the process. ::: moniker-end

You can now pull the container from the registry to any host capable of running Docker images, for example Azure Container Instances.

Related content

Quickstart: Deploy a container instance in Azure using the Azure CLI