Challenge 07 - Build and Push Docker Image to Container Registry

< Previous Challenge - Home - Next Challenge >

Introduction

Now, we need to extend our workflow with steps to build a docker image and push it to Azure Container Registry (ACR). In the NEXT challenge, we will configure the Web App to pull the image from ACR.

Containers are a great way to package and deploy applications consistently across environments. If you are new to containers, there are 3 key steps to creating and publishing an image - outlined below. Because this is a What The Hack focused on DevOps and not containers, we’ve strived to make this challenge as straightforward as possible.

  1. docker login - you need to login to the container registry that you will push your image to. As you can imagine, you don’t want anyone to publish an image in your registry, so it is often setup as a private registry…requiring authentication to push and pull images.

  2. docker build - you need to call docker.exe (running locally on your machine or on your build server) to create the container image. A critical component of this is the Dockerfile, which gives instructions to docker.exe on how to build the image, the files to copy, ports to expose and startup commands.

  3. docker push - once you have created your docker image, you need to store it in the container registry, which is our secured and centralized location to store docker images. Docker supports a push command that copies the docker image to the registry in the proper repository. A repository is a logical way of grouping and versioning docker images.

Description

In this challenge, you will build and push a docker image to ACR:

Success Criteria

Learning Resources

Tips

Advanced Challenges (optional)

< Previous Challenge - Home - Next Challenge >