Deploying Docker hosts in Abiquo based clouds

By Marc Cirauqui, Support Engineer @ Abiquo

You might have heard of Docker, right? The wikipedia entry for it states it is “a software technology providing containers”, which have been around for some time, but nowadays and thanks to Docker they have become easier to use with a set of tools built around them that allow new ways to develop, package and deploy applications.

Docker is installed on top of an already running operating system. So. with packages for multiple platforms available you can just follow the installation instructions for your platform and you are ready to go. But there is another way to automate the installation.

One of the many tools built by Docker is Docker Machine, which is a tool that automates the deployment and installation of Docker hosts in compatible platforms. There are two main use cases for this tool.

1. Use Docker in an unsupported platform

Let’s Say you use a Mac or Windows laptop and want to use Docker. Using Docker Machine allows you to create a VM in your laptop (using VirtualBox for example) and setup that VM to run the Docker daemon with a single command.

2. Create remote Docker hosts

Docker machine has drivers for multiple public cloud offerings, and that allows you to create and provision Docker hosts in multiple clouds using a single tool. Then, each of those machines can be managed using the Docker client and other standard tools installed in your laptop. And this is the use case we will focus on today.

We have been working on creating a driver for Docker machine that will allow this tool to provision Docker hosts on Abiquo clouds. The driver is available at GitHub and is open source and free to use.

Installing the driver is very simple. Provided you already have Docker machine installed in your system, you just need to grab the latest release of the driver here, and copy it somewhere in your PATH. Once you do that, Docker machine will pick up the driver automatically.

In order to create a Docker host in your Abiquo cloud, you will need to provide some details though. Let’s see an example.

$ docker-machine create -d abiquo \
      --abiquo-api-insecure \
      --abiquo-api-username myuser \
      --abiquo-api-password mypass \
      --abiquo-api-url https://my.abiquo.com/api \
      --abiquo-vdc 'MyVDC'
      --abiquo-template-name ubuntu1704 \
      --abiquo-public-ip \
      --abiquo-hwprofile 'medium' \
      --abiquo-ssh-key ~/.ssh/id_rsa \
      docker-test

So, we obviously have to tell Docker machine to use the Abiquo driver (`-d abiquo`), then give Abiquo API details (abiquo-api-username and abiquo-password for the user and pass, abiquo-api-url for the API endpoint, and in this case, abiquo-api-insecure since this environment was using a self signed certificate).

The next options are to specify the virtual datacenter to use (`abiquo-vdc`), the template used to create the VM (`abiquo-template-name`) and a hardware profile to use. In this example we are also instructing Docker machine to allocate a public IP to the VM so we can reach it and the SSH key file to use. The reference of available options can be found in the GitHub repo readme. Finally, the name of the Docker host as referenced by Docker machine is provided.

Docker machine then will take care of deploying the VM and then connect through SSH and perform all the necessary steps so Docker daemon runs on the VM. We also have a command that will setup the client in our workstation to consume the Docker API from that daemon:

$ eval $(docker-machine env docker-test)

From this point, any `docker` commands we run will be run on the created machine.

About Abiquo

Abiquo delivers the industry’s leading cloud orchestration software for service provider clouds; allowing customers to quickly build and monetise cloud services, whilst managing hybrid, private or public cloud infrastructure from one intuitive portal – adding value through greater efficiency, visibility, simplicity and control.

Abiquo is privately held, and operates from headquarters in the UK with offices in Europe, and through its extensive global partner network. For more information, contact us.