Docker is an open platform that helps developers, testers, and Ops team to develop, test, and deploy containers to different environments faster and in an efficient manner.
Multiple containers can be hosted in one virtual machine so:
- It reduces the need to configure virtual machines,
- Containers are hosted in isolation and they cannot affect each other.
- Containers sharing the OS core and it leads to smaller size, faster boot time, as well as better utilization of resources
- Containers can be stored and be reused for future use
The legacy implementation that is purely based on VMs, uses a VM per application and all VMs are managed by a Hypervisor:
|App A||App B|
|VM A||VM B|
In the container based approach, The Host OS is shared between different containers:
|App A||App B|
In other words Docker can be (informally) called as a versioning system. However, the versioning is not on the source code, but on the containers running the code.
For complete overview and architecture of Docker, please check Docker documentation.
In order to prepare and host Docker containers on Azure, first we need to install the following tools on our local machine.
Installing Azure Cross Platform CLI Tools
Cross Platform CLI is available for all platforms in order to interact with Azure. The easiest way to install it on any OS is to use Node Package Manager (I am using a Linux VM on my machine – For other OSes refer to the documentation):
- Install Node.JS and NPM:
- Installing Azure CLI package
Configuring Azure Cross platform CLI
Before starting using Azure CLI tool, we need to pair it with our Azure subscription:
- Download the Azure subscription file
- It should open the browser window and download publish setting file,
- Import the publishing setting file
In order to install Docker simply use the following command:
Starting the Host
We need to have a host OS in order to have Docker on that. In this case our host OS is an Azure Virtual Machine. The OS we are using is Ubuntu 14.04 LTS.
The above command lists all the vm images contains the word 14_04 (the version we are interested in). Find the version you prefer to use from the list.
Using the following command you can create the Host VM:
Validating the Host VM
After running the above command, if everything ran successfully, we should be able to see the host OS in the azure portal.
- Login to Azure Portal,
- Check the VM section,
- When we were creating the VM, we asked Azure to use port 22 for SSH as well as username and password we can use
And we should successfully be able to connect to the host OS. This shows that the VM has been created successfully.
- Using docker we can get the detailed information about the host OS. If the following returns the info it means that our host OS is ready.
By default, docker uses port 4243 but in case we want to use a different port, we can use –docker-port when we are creating the docker vm.
We successfully created the host OS. In the next post we will create containers on this host OS.
Categories: Azure, Docker,