Building Docker Images

There are a number of ways in which you can create a docker image. These include:

Copy And Commit

In this method, you copy to a container and then commit that container as an image.

For more information and detailed steps, see Copy and Commit

Docker Build Command

The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH or URL. The build process can refer to any of the files in the context.

For more information and detailed steps, see Docker Build Command

Trigger Build From A Docker Compose File

This approach calls the exact same Dockerfile mentioned above, but allows you to specify the ‘Recipe’ for the image in advance. For example, the resulting image name, the context and any parameters that should be used. This allows for a much faster and consistent deployment.

For more information and detailed steps, see Trigger Build From A Docker Compose File

Build and Push to Azure Container Repository

Just as you can use docker commands to build images locally, you can instead use ACR Commands to trigger builds remotely on your Azure Container Repository.

For more information on this see: Building Docker Images: Using ACR Build Command

Trigger Automated Build to Azure Container Repository

If you intend to start using docker images in production, then you need to start automating the building of your images. With ACR tasks, you can add a hook that monitors your code repository for Pull Requests or commits. This can then trigger a build and save the resulting image to your container repository.

For more information on this see: Building Docker Images: Using ACR Tasks

Leave a Reply

Your email address will not be published. Required fields are marked *