When it comes to DevOps Docker is an integral part of it. Nowadays no development can be done without the help of docker. In this article, we will discuss how can we use Azure DevOps Pipeline to build and push images to the Azure container registry. Here is the end-to-end Video of this post. I have created a solution that shows an end-to-end demo of this concept.
What is Azure Container Registry?
Azure Container Registry is a private registry for hosting container images. Using the Azure Container Registry, you can store Docker-formatted images for all types of container deployments. Azure Container Registry integrates very well with orchestrators hosted in Azure Container Service, including Docker Swarm, DC/OS, and Kubernetes. You can use the familiar tooling capable of working with the open-source Docker Registry v2 so it is a seamless experience for Docker hub users.
Here are the features of the Azure container registry:
- Store and manage container images across all types of Azure deployments
- Use familiar, open-source Docker command line interface (CLI) tools
- Keep container images near production deployments to reduce network latency and costs.
- Simplify registry access management with Azure Active Directory by granting access based on Role-based access control.
- Maintain Windows and Linux container images in a single Docker registry.
What is DevOps Pipeline?
DevOps pipeline is used for implementing CI/CD process to automate building, testing, and deployment of code.

- A pipeline enables a constant flow of changes into production via an automated software production line.
- Pipelines create a repeatable, reliable, and incrementally improving process for taking software from concept to customer.
- Pipelines require infrastructure, this infrastructure will have a direct impact on the effectiveness of the pipeline
What is Azure Pipeline?
Azure Pipelines is a cloud service that you can use to automatically build and test your code and make it available to other users.
Features of Azure Pipeline.
- Work with any language or platform – Python, Java, PHP, Ruby, C#, and Go
- Deploy to different types of targets at the same time
- Integrate with Azure deployments – Container registries, virtual machines, Azure services, or any on-premises or cloud target (Microsoft Azure, Google Cloud, or AWS)
- Build on Windows, Linux, or macOS machines
- Integrate with GitHub
- Work with open-source projects
Solution Overview
In this solution, we will create an Azure container registry and then build a Docker image from the Github code repo to push the image into the Azure container registry. This is a typical solution used for any DevOps Pipeline.

First, we will clone the code from the existing sample Github Repo and then create an Azure resource group and container registry. Here is the code:
git clone https://github.com/MicrosoftDocs/pipelines-javascript-docker az login #I have used Powershell ISE to run Azure CLI code #but if you want to use Azure CLI then change these variables #accordingly by removing $ $rg="demo-rg" $acrname="myacr07" $loc="eastus" # Create a resource group az group create --name $rg --location $loc # Create a container registry az acr create --resource-group $rg --name $acrname --sku Basic
Then I created Azure Pipeline and here are step-by-step instructions:
- Go to Your Azure DevOps Org

2. Select Pipeline to create the pipeline.

3. Create a new Pipeline.

4. Select your code organization.

5. Select GitHub Repo.

6. Configure the pipeline.

7. Select the image configurations.

8. Review Image config. Actually when you selected the “Build and push the image into Docker registry” option while configuring the pipeline Azure creates this template which has a built-in Task to build and push the docker image into Azure Container Registry.

9. Test if the container image is pushed into the Azure Container registry or not? We can see that the Image is pushed successfully.

I hope you enjoyed it.