Create a new swarm on Microsoft Azure in Docker CloudEstimated reading time: 4 minutes
You can now create new Docker Swarms from within Docker Cloud as well as register existing swarms.
When you create a swarm, Docker Cloud connects to the Cloud provider on your behalf, and uses the provider’s APIs and a provider-specific template to launch Docker instances. The instances are then joined to a swarm and the swarm is configured using your input. When you access the swarm from Docker Cloud, the system forwards your commands directly to the Docker instances running in the swarm.
Link Docker Cloud to your service provider
To create a swarm, you need to give Docker Cloud permission to deploy swarm nodes on your behalf in your cloud services provider account.
If you haven’t yet linked Docker Cloud to Azure, follow the steps in Link Microsoft Azure Cloud Services to Docker Cloud. Once it’s linked, it shows up on the Swarms -> Create page as a connected service provider.
Note: If you are using a Microsoft Azure Visual Studio MSDN subscription, you need to enable programmatic deployments on the Docker CE VM Azure Marketplace item. See the Microsoft Azure blog post on Working with Marketplace Images on Azure Resource Manager for instructions on how to do this.
Create a swarm
If necessary, log in to Docker Cloud and switch to Swarm Mode
Click Swarms in the top navigation, then click Create.
Alternatively, you can select + -> Swarm from the top navigation to get to the same page.
Enter a name for the new swarm.
Your Docker ID is pre-populated. In the example, our swarm name is “vote_swarm”.
Tip: Use all lower case letters for swarm names. No spaces, capitalized letters, or special characters other than
Select Microsoft Azure as the service provider, select a channel (
Edge) from the drop-down menu, provide an App name, and select the Azure Subscription you want to use.
In this example, we use the
Stablechannel, our app name is “voting_app” and we’ve selected a Pay-As-You-Go subscription.
Make sure that Create new resource group is selected, provide a name for the group, and select a location from the drop-down menu.
Our example app is called
swarm_vote_resources, and it is located in West US.
Tip: Be sure to create a new resource group for a swarm. If you choose to use an existing group, the swarm fails as Azure does not currently support this.
Choose how many swarm managers and worker nodes to deploy.
Configure swarm properties, SSH key and resource cleanup.
Copy-paste the public SSH key you want to use to connect to the nodes. (Provide the one for which you have the private key locally.)
To list existing SSH keys:
ls -al ~/.ssh
To copy the public SSH key to your clipboard:
pbcopy < ~/.ssh/id_rsa.pub
Choose whether to provide daily resource cleanup. (Enabling this option helps avoid charges for resources that you are no longer using.)
Select the machine sizes for the managers, and for the workers.
The larger your swarm, the larger the machine size you should use. To learn more about resource setup, see configuration options in the Docker for Azure topics.
You can find Microsoft Azure Linux Virtual Machine pricing and options here.
Docker for Azure bootstraps all of the recommended infrastructure to start using Docker on Azure automatically. You don’t need to worry about rolling your own instances, security groups, or load balancers when using Docker for Azure. (To learn more, see Why Docker for Azure.)
This takes a few minutes. When the swarm is ready, its indicator on the Swarms page shows steady green.
Note: At this time, you cannot add nodes to a swarm from within Docker Cloud. To add new nodes to an existing swarm, log in to your Azure account, and add nodes manually. (You can unregister or dissolve swarms directly from Docker Cloud.)
Where to go next
Learn how to connect to a swarm through Docker Cloud.
Learn how to register existing swarms.
You can get an overivew of topics on swarms in Docker Cloud.
To find out more about Docker swarm in general, see the Docker engine Swarm Mode overview.swarm mode, swarms, create swarm, Cloud, Azure