0
0
Azurecloud~30 mins

ACR image building and pushing in Azure - Mini Project: Build & Apply

Choose your learning style9 modes available
ACR image building and pushing
📖 Scenario: You work as a cloud engineer for a company that uses Azure Container Registry (ACR) to store Docker container images. Your team wants to automate the process of building a Docker image from source code and pushing it to ACR for deployment.
🎯 Goal: Build a Docker image from a simple Dockerfile and push it to an Azure Container Registry repository using Azure CLI commands.
📋 What You'll Learn
Create a variable for the Azure Container Registry name
Create a variable for the Docker image name and tag
Use Azure CLI to build the Docker image with az acr build
Verify the built image in the Azure Container Registry
💡 Why This Matters
🌍 Real World
Automating container image builds and pushes to Azure Container Registry is common in DevOps pipelines for cloud applications.
💼 Career
Cloud engineers and DevOps professionals use these skills to manage containerized applications and streamline deployments.
Progress0 / 4 steps
1
Set the Azure Container Registry name
Create a variable called acr_name and set it to the exact string mycontainerregistry which is the name of your Azure Container Registry.
Azure
Need a hint?

The Azure Container Registry name is a unique string identifying your registry. Use the exact name mycontainerregistry.

2
Set the Docker image name and tag
Create a variable called image_name and set it to the exact string myapp:v1 which represents the Docker image name and tag.
Azure
Need a hint?

The Docker image name includes the tag after a colon. Use myapp:v1 exactly.

3
Build the Docker image using Azure CLI
Write a command string called build_command that uses az acr build to build the Docker image. Use the variables acr_name and image_name in the command. The command should build from the current directory ..
Azure
Need a hint?

Use an f-string to insert acr_name and image_name into the az acr build command. The build context is the current directory ..

4
Verify the Docker image in Azure Container Registry
Write a command string called push_command that uses az acr repository show to confirm the image exists in the registry. Use acr_name and image_name variables in the command.
Azure
Need a hint?

Use az acr repository show with --name for the registry and --image for the image name to confirm the image is pushed.