Module 5: Assignment - 2

Tasks To Be Performed:

  1. Create an Azure Container Registry and connect it to Docker running in VM
  2. Upload the image you created in this Azure to container registry
  3. Create an app service to deploy the same image

Using image from Assignment 1:Module 5


Installing Azure CLI:

sudo apt install azure-cli


Step 1: Create an Azure Container Registry

  1. I Open the Azure Portal:

  2. I Create the Container Registry:

    • I search for “Container registries” and click “+Create”.
    • I fill in the required details, such as the registry name, subscription, resource group, and location.
    • I choose the pricing tier Standard
    • I review and create the container registry.

Step 2: Connect the Registry to Docker in the VM

hectorregistry hectorregistry.azurecr.io

  1. I Log into the VM:

    • I SSH into my VM where Docker is installed.
  2. I Log into the Azure Container Registry from the VM:

    • I use the Azure to authenticate to the ACR: az login






Step 3: Upload the Image to Azure Container Registry

  1. I Tag the Docker Image:

    • Before pushing the image to ACR, I need to tag it with the ACR login server name:
docker tag mynewimage:latest <registry_name>.azurecr.io/mynewimage:latest
docker tag hshar/webapp_updated:latest hectorregistry.azurecr.io/webapp_updated:latest


  1. I Push the Image to ACR:
  • Login to the container registry
sudo az acr login --name hectorregistry


  • I use the Docker CLI to push the image to the ACR:
sudo docker push hectorregistry.azurecr.io/webapp_updated:latest


Back in the portal I verity the image was uploaded

Step 4: Create an App Service to Deploy the Image

  1. I Open the Azure Portal Again:

    • I navigate back to the Azure Portal.
  2. I Create a New App Service:

    • I search for “App Services”.

    • I click ”+ Create” and select ”+ Web App”.

    • I fill in the details such as the app name, subscription, resource group, and plan.

    • make sure select right OS Linux and for “Publish” select “Docker Container”

    • Under “Docker,” I select the “Single Container” option.

    • I choose Azure Container Registry as the source and select the image I pushed earlier.

  3. I Review and Create the Web App:

    • I review all the settings and click “Create” to deploy the web app.
  4. I Verify the Deployment:

    • I “Got to resource”
    • Once the app is deployed, I navigate to the URL provided by the App Service.
    • I should see the application running, served by the Docker image deployed from ACR.