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 will now push the local Docker image to the registry you created in Azure.
Start by opening the WSL console, where you type:
sudo docker images
This command will display the list of local Docker images (we display this to have all the necessary information, like the image name and tag available). Then, we need to tag the local image with the fully qualified name of the container registry (login server) we created in Azure. To display the fully qualified name of the registry, we type:
az acr list -o table
Subsequently, we tag the image using the login server:
sudo docker tag people.webapp:v1 people.azurecr.io/people.webapp:v1
The last command does not provide any output. To ensure the local image was correctly tagged, we type (Figure 22):
sudo docker images
Finally, we push the image to the remote registry. We proceed as follows:
sudo az login
Then open https://microsoft.com/devicelogin and use the code provided by the above command.
Login to Azure Container Registry:
sudo az acr login -n people
sudo docker push people.azurecr.io/people.webapp:v1
To confirm the image was pushed, type:
az acr repository show -n people --repository people.webapp -o table
The output from the commands above is shown here:
This part of the tutorial taught you how to create the container registry in Microsoft Azure and push the local Docker image to the remote repository. Along the way, you learned how to work with Azure Command Line Interface (Azure CLI
) to create and manage resources in Azure.