Introduction
Motivation
Creating the Virtual Machine
Connecting to the Virtual Machine
Installing application dependencies and running the application
Create a Dockerfile using Visual Studio Code
Building a Docker image
Azure Container Registry
Pushing the local image to Azure Container Registry
Review
Next Steps
You have now learned how to containerize the application. In this next step, you will push the Docker image to the Azure Container Registry. Before you can push the image, you will need to create the container registry in Azure.
To create the Azure Container Registry, we will use the Azure Command Line Interface (Azure CLI
):
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az login
The command will open the web browser and redirect to the Azure login page. Use this page to provide your credentials.
Now create the resource group name rg-arm64 with a default location set to EastUS:
az group create -n rg-arm64 -l eastus
az acr create -n people -g rg-arm64 --sku Basic
The output of the above commands will look as shown below:
In the next step, we must configure the role assignment so that the current Azure user can push Docker images to the Azure Container Registry. To do so, we use the WSL terminal, in which we type:
USER_ID=$(az ad user show --id "<YOUR_USER_ID>" –query "id" -o tsv)
ACR_ID = $(az acr list --query "[?contains(name, 'people')].id" -o tsv)
az role assignment create --assignee $USER_ID --role AcrPush --scope $ACR_ID
The last command’s output will look as follows: