Docker Swarm with Azure Container Services and Azure Resource Manager


by Carlos Leon

Docker Swarm with Azure Container Services and Azure Resource Manager

In an earlier post we explained how easy it is to setup a Docker Swarm cluster in Azure using Azure Container Services and Terraform.

We understand that not everybody is ready to adopt Terraform in their companies and, even though we can help you get there, we have written this other guide to achieve exactly the same results we got from the previous exercise, this time using the good ol’ Azure Resource Manager with the Azure CLI 2.0 tool and Azure Resource Manager Templates. In this way you can setup a Swarm Cluster in Azure without having to learn/install/adopt Terraform within your company (although you should).


Azure Container Services makes it easy for DevOps engineers and Operators in general to create and manage clusters that run an orchestrator for shipping your containers at scale. The engines that are being offered as of the writing of this blog post are:

By abstracting the concept of orchestration tool into what is known in Azure as a Container Service, you can forget about the underlying infrastructure and focus on actually trying the tool out.

What this means is that a Kubernetes cluster is, in essence, a single instance of an Azure Container Service. The same goes for a Docker Swarm cluster and a Mesosphere DC/OS cluster. In the end, all of them deploy containers, the only thing being different is the way they work under the hood.
But Azure has abstracted away the setting up and bootstrapping of the cluster so that you don’t have to worry about the operational challenges that come with adopting such technologies.


Special note about the Azure CLI tool

Make sure that you have logged in with the CLI tool before you attempt to create any resource group or deploy the Container Service explained later in this guide.

Getting Started

As with Terraform, setting up an Azure Container Service instance powered by Docker Swarm is very easy, although if you are not familiar with Azure Resource Manager Templates (Microsoft’s alternative to AWS CloudFormation) it may take you a while to get used to it (it helps if you’re familiar with CloudFormation).

The Template

Below you will find the Azure Resource Manager Template with the definition of your Azure Container Service instance. Name the file acs.json

The Parameters File

If you read carefully, there are some parameters that you can (and should) adjust before you deploy the cluster to your Azure account. Name the file acs.params.json

(Optional) Creating The Resource Group

If you do not yet have a resource group created, or if you wish to create a resource group for the sake of this exercise, you can do so with the following command

Where FOO is the name of the resource group you want to create (keep it simple, lowercase and no special characters) and the location where you want to place this resource group. Find in the appendix a link to the official list of regions available in Azure.

Creating The Cluster

After you have adjusted the parameters file according to your needs, create the cluster with the Azure CLI tool like this:

Make sure that you replace YOUR_RESOURCE_GROUP with the actual name of your resource group.

Accessing The Cluster

When the Azure CLI tool is done applying the changes to the infrastructure you can then go ahead to the Azure Portal, find the Container Service blade and locate the instance that you just created. In the Overview blade you will be able to locate the following information:

  1. Master FQDN: This is the endpoint you can use to talk to your Swarm manager. SSH into it and deploy your services as you would regularly do.
  2. There is also docker-compose available in this master node.
  3. Agent Pool FQDN: this is the DNS name that you will want to use to reach the services that you deploy to your Swarm cluster.
  4. For example, let’s say that your Agent Pool URL is and you are running a service in your Swarm Cluster in Azure on port 8080, then the way to reach this service is by using the URL


It’s important to mention that even though the machines created by the Azure Container Service are running a fairly up-to-date version of Docker (17.04.0-ce), the Swarm Cluster that runs inside the Container Service is not the newest Swarm Mode but instead is the old swarm/1.1.0.

Useful resources


Leave a Reply

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