In this blog we are going to go step by step through the process of building a Docker Swarm in Azure running on CentOS.The audience for this blog post is anyone who has an interest in Docker and or Azure. There is very little assumed knowledge other than a power user's level of knowledge and how to use ssh or Putty. This post is written in a simple way to guide the uninitiated thru the process. The take away from this blog post will be an enhanced knowledge of both Docker and Azure.You will also have a functioning non-prod, Docker Swarm, running Nginx web servers horizontally scaled in the Azure cloud!
First of all, what is Swarm?
Docker Swarm will allow you to run containers scaled horizontally across several hosts for scalability, redundancy and load balancing.The end product if you complete 3 parts of the blog post would be a functioning Swarm cluster that you can run stuff on.
Docker Swarm is an orchestration tool for Docker containers. The Swarm can abstract away the containers to a concept known as "services". Where the engineer is interacting with nodes as a single virtual system.
There are many ways to use containers in Azure, we are only exploring one of them.
Step 1: Acquire an Azure subscription and log into portal.azure.com. Click on the green plus sign and search for "centos"
Step 2 : Select the CentOS 7.3 that is returned from the search , keep the drop down at "Resource Manager" and click "Create"
Step 3: Fill in a descriptive name (docker-node-01), pick a user name and password, set authentication type to "Password"
Step 4: If necessary select the appropriate "Subscription", create and name a new "Resource group" and leave the "Location" as is. Verify all the information you entered and if you are satisfied click the blue "OK" at the bottom of the screen.
Step 5: This is your call here, but I would select at least a "DS2" VM size for any practical use.click "Select"
Step 6: Click "OK at the next page, we will not be changing anything on this page. However, it would be valuable to glance over the settings for a bit.Finally, you will see the validation page, review the information here and click the blue "OK" on the bottom of the page.
Step 7: Go back to Step 1 and repeat the possess two more times EXCEPT you will want to use a unique name for the instance and will be using the same resource group you set up for the first node.In our case, the Resource Group is "Docker".
Step 8 : Verify your current setup, you should have 3 CentOS images in a single Resource Group. note that many of the ancillary items have been created automatically for you. To look at this in Azure click on the Resource Group icon, select the correct resource group and filter by "Virtual machines" and you will see the 3 nodes you just set up.