In the previous post I demonstrated how to create docker images using docker-compose. Now I will show you how you can push those images into Azure Container Registry.

Azure CLI

I will be using Azure CLI version 2.0 to interact with Azure from the command prompt.

To make sure you have it installed and it is the right version run az --version in your command prompt to see if it is installed and what is the version.

You can download it from the following Url if you don’t have it:

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest

Create Azure Container Registry

Though you can create Azure Container Registry through the Azure portal, I’m going to do it using the Azure CLI, because the idea is, we are going to automate these processes and save these scripts and run them when we need them.

Just like any other Azure Resource, to create one, we need to put them in a resource group so it is easier to us to manage later on.

We will use the “az group create” Azure CLI command.

In the following example we are creating a Resource Group called “azurecontainerservicepoc” and located in “westus”

az group create --name azurecontainerservicepoc --location westus

NOTE: if you have not logged in with Azure CLI, you can use the “az login” CLI command to authenticate to your Azure Account.

Now, we can create the Azure Container Registry with the az acr create and put it in the Resource Group we just created

az acr create --resource-group azurecontainerservicepoc --name acrarampoc --sku Basic --admin-enabled true