Before reading the article, you have to know that I'm not going to explain what are Docker and Container etc. On the internet, you may be able to find a lot of article series to understand Container and Docker structure. Basically, in this one, we will comprehend how can we create docker host on Azure via Docker Machine CLI. I could say, One brief (and incomplete) description is that Docker creates something similar to Virtual Machines, only that Docker containers run on the host machine's OS, rather than on a VM. Each Docker container should ideally contain one service and an application can comprise multiple containers.
As you know, when you install the docker on your machine, it provides command line interface for using and managing your docker hosts. Docker Machine supports to create new docker hosts also contains a lot of parameters when its a deployed which that is why I'm using Docker-Machine CLI to launch new docker host on my hypervisor. I've been testing the deployment of a new docker host on various platform such as Linux, Windows. It gives the easiest way to create new docker hosts. For instance, you are testing your container on your docker host and you want to scale your application. You want to involve your docker application in cluster environments. Also, you may need getting a new docker host to create cluster environments. Here it is, an easy way to get new docker host using Docker-Machine CLI and join to your cluster environments. Before we start, you can find requirements for creating new docker hosts.
Before you begin, you need to know your subscription-Id which will be used by docker-machine. Here it is, the easiest way to find your Azure subscription Id.
After running these lines, you will get your subscription id and to keep it. Because we will use it when we are using docker-machine cli. You can find below.
Create new docker host on Microsoft Azure
We are going to learn Docker-Machine CLI and what are its parameters also how can we use it. We should know Docker-Machine CLI parameters and what type of parameters need to use. Docker-Machine CLI uses 'create' and 'driver' options when we are creating new docker host on Azure After that we remark these commands, it will give you chance to use some operational parameters.I have added the detail of parameters of Docker-Machine CLI.
As you can see the above on the picture just one line is red. It means the parameter should not be blank. Let's have a look example of docker-machine create command.
docker-machine create --driver azure ` --azure-subscription-id $SubscriptionId[0] ` --azure-subnet-prefix 192.168.10.0/24 ` --azure-open-port 22 ` --azure-private-ip-address 192.168.10.10 ` --azure-resource-group 'RG-DockerNodes' ` --azure-location 'West Europe' ` 'dockernode-azure'
As you see above, the picture shows an example of Docker-Machine CLI parameters. The first parameter should have to be your provider. As you know, our provider's is Azure. We can put this line 'Azure'. However, Second Line should not be blank or null, you know this parameter is required. Because we have to remark our subscription Id which will be placed our resources. Let's complete our docker machine commands.
I have executed Docker-Machine Command which is in the above picture. So, It did create a new Docker Host on Azure. Now, We can manage our new docker host with Docker-Machine CLI like we can create a container, network etc. Here is screenshot of our new docker host on Azure that I wanted to show you.
On the Azure Portal, we can see our new docker host. Let's now we can get details of the node on Docker-Machine CLI. For these details, we should use Docker-Machine ls command.
In this article, we have done to create new docker host on Azure. We have a lot of ways to create a new one. We have selected to create with Docker Machine CLI. For Azure perspective, we can use Powershell, Template Deployment.