Before I will start talking about scaling this Blog, I first need to talk about docker-machine. Docker-Machine is a tool for creating and managing hosts that will run Docker containers. If you use docker-machine to create your host, you can then perform the following actions remotely using docker-machine
- Starting, stopping, restarting
- Upgrading Docker
- Configuring the Docker client to talk to your host
The really great thing is that you can use it to create Docker hosts on several Cloud suppliers. Currently the following drivers as Docker machines calls them are supported:
- Amazon Web Services
- Digital Ocean
- Google Compute Engine
- IBM Softlayer
- Microsoft Azure
- Microsoft Hyper-V
- Oracle VirtualBox
- VMware Fusion
- VMware vCloud Air
- VMware vSphere
This also includes Virtualization using Microsoft Hyper-V or VMwarevSphere. I will be using the cloud provider on which this Blog is running, Microsoft Azure.
I will be running docker-machine on a linux host. It is however also possible to run the tool on the Windows platform. The easiest way to get docker-machine is to download it from the releases page of docker machine on GitHub. The tool is still in beta / pre release, so expect changes in the future.
The first thing you need to do before running docker machine to create hosts on Microsoft Azure is to generate a certificate that you will install in Microsoft Azure to allow docker machine to access Microsoft Azure.
Generating a certificate valid for Azure can be done using the following commands on Ubuntu.
azurecert.cer file must be uploaded to the Management Certificates under Settings in the Azure management portal.
After the certificate is uploaded, the docker host, an Ubuntu machine can be created using the following command.
Docker-machine will connect to Microsoft Azure to create the actual docker host. This will take some time.
When the command finished, the Microsoft Azure portal shows the new host up and running.
After performing the command logged at the end of the output of the docker-machine command
$(docker-machine env ubuntuviadockermachine) your local docker client will point your to the newly created docker host. This means that when you will then issue a docker command, it will actually be executed on the remote host, pretty cool!
If you type the following command docker machine will show you the environment variables and it will show you that it is actually connected to the remote Docker host.
Docker-machine contains several commands to manage Docker hosts. For example, the command
ls to list the available hosts.
Now you can simply issue docker command and they will be executed on the remote host. For example, doing a hello world via de busybox docker image.
With Docker-machine in place we are now ready to scale this blog using docker swarm. Which will be the topic of the next post.