Create Web App from Docker Container in Azure

45 minutes
  • 5 Learning Objectives

About this Hands-on Lab

You have a custom application that your company wants you to deploy. This application is optimized for containers, and you have been given a Dockerfile. The company mandates that all container images be stored in Azure Container Registry. Find the best solution to host your containerized application in Azure App Service.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Start Cloud Shell
  1. Click the Cloud Shell icon (>_) in the upper right.
    1. Select Bash.
    2. Click Show advanced settings.
    3. Change Cloud Shell Region to the same location as your lab provided resource group.
    4. For Storage account, select Use existing.
    5. For File share, select Create new and give it a name of "fileshare".
    6. Click Create storage.
Set Resource Variables in Cloud Shell
  1. Set the ACR (Azure Container Registry) variable. You can use any unique meaningful name for the "<ACR_NAME>":
  2. In the Azure portal, click the listed resource group name.
  3. Copy it to your clipboard.
  4. In Cloud Shell, set the RG variable, replacing <RESOURCE_GROUP_NAME> with the name you just copied.
Create a New Container Registry

Create a new Azure Container Registry.

Build an Image and Push to ACR
  1. Change the directory to clouddrive.

    1. Clone the js-docker branch of the github repository.
    2. Change the directory to js-docker.
    3. Build and push the image to Azure Container Registry using ACR Tasks and the Dockerfile provided.
Create and Deploy a New Web App
  1. In the Azure portal, open the upper left menu and click App Services.

    1. In the upper left, click +Create.
    2. On the Create Web App page, set the following values:
    • Resource Group: Existing resource group
    • Name: Unique name
    • Publish: Docker Container
      1. In Sku and size, click Change size.
      2. Click See additional options and select the Standard S1 size.
      3. Click Apply.
      4. Click Next: Docker.
      5. In Image Source, select Azure Container Registry and click Review + create.

Additional Resources

Even though you don't have Docker installed on your machine, ACR Tasks will build and push your application to Azure Container Registry.

Create a new container registry and use ACR Tasks to build and push your container image using the Dockerfile located in this GitHub repository.

After you've pushed your container image, deploy an Azure web app using the newly created container image. Load the URL in your browser to see a special message!

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?