The Easy Way To Run Docker Containers on Azure

Dr. Joe Logan
3 min readSep 30, 2019


Running docker containers on Azure doesn’t need to be complicated, and you don’t even need Docker installed locally! All you need is the Azure CLI toolkit, which you can get easily through a package manager, for example on MacOS you can run:

brew install azure-cli

Once you have the CLI installed, authenticate with the credentials you use to access Azure. The following command brings up a web browser so that you can login:

az login

Once you have authenticated the CLI with Azure, head over to the Azure web portal, and look in ‘All Services’ and favourite both ‘Container Registries’ and ‘Container Instances’. Then head on into Container Registries. Click the plus icon to create a new registry, and fill out the necessary details. Make sure you enable the ‘admin user’ or you will run into authentication issues later. Avoid the headaches, and enable it now.

Now with a registry set up, head back over to your terminal, and to the directory where you have your code with the Dockerfile. You can then push this code directly to Azure and build it remotely with the following command:

az acr build --registry <REGISTRY-NAME> --image myimage:v1 .

Replace <REGISTRY-NAME> with the name of the registry you set up, and feel free to change the name of the image and / or tags. This will be how you reference your image later.

Now head back into your Azure Container Registry, and click on the name of the registry that you set up. Best to open a notepad here, as there are three bits of information you need from here.

Firstly you will need the address of the login server. Simply copy the URL from below ‘Login Server’ at the top of the Overview screen.

Secondly you will need the credentials for the login server. Select ‘Access Keys’ from the bar on the left, and copy both the username and the password from below the ‘Admin User’ section.

Finally you will need the image path for the image that you just pushed to Azure. Click on ‘Repositories’ and select both the image name and tag. You will see a docker pull command that looks similar to docker pull Simply copy the URL omitting the docker pull bit at the start. This is your Container Registry image path.

Now that you have the URL of your login server, the access credentials for it, and the path of the image that you want to deploy, you can head over the ‘Container Instances’ section on the left sidebar. Click the ‘Add’ button to create a new instance.

The Azure Container Instances Create Screen

Now select your resource group and give the container a name and region. Ensure you select a ‘Private’ image type, and populate the details with the information you copied earlier. Choose a size for the instance, and proceed through the screens that set up networking and DNS.

Congrats, you now have a Docker instance running in Azure!



Dr. Joe Logan

Developer and AI enthisiast from Sydney. Founder of Alixir. Check me out @