Getting started with Docker on Azure

September 7, 2015 | Comments(0) |

Docker is on the verge of becoming one of the most popular virtualization approaches which uses Linux containers as a way to segregate application data and underlying infrastructure on your shared resources rather than virtual machines. Docker automates the deployment of any application as a portable, self-sufficient container which will run almost anywhere – including Microsoft Azure.

Associated with Azure Virtual Machines (VM’s), Microsoft Azure provides VM Extensions which are developed by Microsoft and by other trusted third-party providers. VM extensions enable security, runtime, debugging, management, and other dynamic features by which the productivity of Virtual machines can be exploited. The Azure Virtual Machine Agent is used to install, configure, manage and run VM Extensions. You can configure VM agent and VM extensions either during the VM creation or on an existing VM. This can be done using the Management Portal, PowerShell cmdlets or the xplat-cli.

So, using a Docker VM extension and along with the Azure Linux Agent we can create a Docker VM that hosts any number of containers for your applications on Azure. The Docker VM Extension has some very cool features like Docker Hub integration, Docker Compose support and Docker Hub/Registry authentication support.

Create Docker VM extension through Azure portal

 

Below are the steps to create a Docker VM extension through the Azure preview portal:

Utilities required:

  • An Azure account
  • A 64 bit preferably Linux client machine, Curl installed on it

Step 1: Create a Ubuntu server 14.04 VM from gallery

Being Microsoft, Azure also supports open source technologies and frameworks. Various Linux flavored VM’s can also be created.

To install Docker, following Ubuntu servers are supported:

  • Ubuntu 15.04
  • Ubuntu 14.04 (LTS)
  • Ubuntu 12.04 (LTS)
  • Ubuntu 13.10

To create Ubuntu server, log into your account in Azure preview portal, Click on New (+), browse to compute, at the marketplace, choose Ubuntu Server 14.04 (LTS) and click Create. Provide all the details and click on Create.

Step 2: Install Docker on your client machine

To generate certificates, you need to install Docker on your client machine (my client machine here is Ubuntu 14.04).  To download and setup Docker,  you need Curl. The purpose of curl is to transfer data to and from, from a server

Step 3: Create Docker certificates

In order to allow the client computer to be able to communicate to your Azure host using https, we need to create a self signed CA certificate, Server certificate and a server key.

Step 4: Add Docker VM extension

Once the certificates are created, at your preview portal navigate to your VM for adding an extension as shown below:
screenshot-portal.azure.com 2015-09-01 13-47-15

Choose “Docker” under New resource

screenshot-portal.azure.com 2015-09-01 13-47-51

Choose the CA, Server certificate and server key

By default Docker port will be 2376, you can provide any port number of your choice and click OK

screenshot-portal.azure.com 2015-09-01 13-52-36

screenshot-portal.azure.com 2015-09-01 13-54-31

Step 5: Add the Docker communication endpoint

  • To communicate to your client machine via internet, it is essential to configure the Docker endpoint.
  • To do so, navigate to your VM, go to its settings
  • Choose Endpoints
  • Click on Add
  • Provide a Name and Port number which you specified in the previous step

screenshot-portal.azure.com 2015-09-01 13-55-40

Step 6: Test your Docker host running on Azure VM

Create Docker VM extension through Marketplace

To setup docker quickly, you can create Docker on Ubuntu server from Azure Marketplace. The Docker containers are lightweight as compared to Virtual Machine images. The Container Apps are available in the Azure Marketplace. You can find and setup repositories from Docker Hub, which include popular workloads like databases, web blogs, caches, search server, and CI tools, integrated with the Azure Marketplace.
At the Azure preview portal, click on New (+) → Compute → Marketplace → compute and then choose Docker on Ubuntu Server and then click on Create.

docker2

docker1
Various flavors of container apps available at Marketplace

Container Apps help you automate the deployment of your applications which are isolated software containers running in single virtualized instance. For E.g.: If chosen “Docker on Ubuntu Server”, Ubuntu server will automatically install the VM extension along with latest Docker engine pre-installed. Since the cost associated with provisioning and managing VM’s is reduced, you are now in a position to leverage your cloud instance to gain maximum with these container apps.

Well, this is just the start for Docker on Azure. Stay tuned and keep following for more blogs on Azure. For any further info, leave a comment.


Leave a Reply