Docker Hub on CloudSigma

How to Run Docker on CloudSigma (with CloudInit) Updated

In the past couple of years, Docker has received a tremendous amount of attention. While the concept of containers is hardly anything new (something we at CloudSigma talked more about in this previous post), Docker appears to have become the go-to container manager.

To automatically deploy Docker at CloudSigma, you will need:

Assuming you’re already familiar with the basics of Docker, you might be interested in the easiest way to deploy Docker on CloudSigma. As it turns out, this is very simple to automate. What we’ll be using is CloudInit and Ubuntu’s Cloud Images (named “Ubuntu 14.04 LTS” in the Marketplace). Please ensure that the image shows the CloudInit logo next to it.

Once you’ve attached this image to  a new server, feel free to optionally resize it according to your needs. For a quick start,  the default 10 GB is sufficient.

Next, ensure you have attached your SSH key to the server you are creating. This can be accomplished using the SSH Keys tab on your server. The key will be valid for the user ubuntu on a Ubuntu distro. Please follow this guide to generate private/public key pairs on Windows.

With that done, click on the new CloudInit link under the Properties of your server.

DockerCloudInit

Now paste in the following and press Activate (and then save your server):

  • Line 2: Upgrade all packages and brings the system up to date.If you’re not familiar with CloudInit, let’s run through what this does.
  • Line 3: If the updates on line 5 require a reboot, go ahead and do it.
  • Line 6: Fetch the Docker install script from the docker website and pipe it into sh, which then proceeds to install Docker for us.
  • Line 7: Install the Docker GPG keychain, ensuring that container images are fetched securely from the official Docker Hub registry.

Shortly after you’ve booted up the server, you should be able to SSH into the server using your SSH key. Depending on the number (and types) of updates that were installed, your server may or may not reboot (Line 3 above) and you may need to log back in using SSH.

After CloudInit is done, you should now be up and running with Docker:

Voilá! You now have a server up and running with Docker. This can of course be automated using our API too, in case you need to create multiple servers.

Using CloudInit to instantly turn a VM into an appliance server:

Combining the power of CloudInit and Docker Hub allows us to bring up VMs to serve as specific appliances. For example, adding the following line to CloudInit’s runcmd: will download the Apache container image from Docker Hub and bind it to port 80 on the VM, instantly turning our VM into a web server.

To ensure this docker container runs every time the VM boots, we add the following line to CloudInit, which inserts the command to our /etc/rc.local startup file.

Running OwnCloud using Docker on CloudSigma

Another popular service you can deploy in a jiffy is OwnCloud, the Open Source Dropbox alternative. To do so, replace httpd in the last two lines with owncloud.

Give your VM a few minutes to update and set things up. Now type in the IP address of your VM into any web browser, and you should see the following:

0036

Voilá! At CloudSigma, you can tailor your Docker VM’s CPU, RAM and storage parameters to perfectly match your Docker container performance requirements. In The OwnCloud example, a VM with a large amount of storage would be best.

We encourage you to browse Docker Hub where you will find an extremely rich choice of services and appliances that you can instantly deploy on CloudSigma’s powerful IaaS cloud. For a more detailed overview of how you can contextualise your CloudSigma VMs using CloudInit, please review CloudSigma’s introduction to server provisioning with CloudInit.

About Alexander Georgiev

Alex is a Project Manager and Technical Writer at CloudSigma. He is a BSc Computer Science graduate from Brunel University, West London, graduating with 1st class Honours. His university dissertation was a modular middleware solution, database and device independent bidirectional SMS alerting system primarily for use in, but not limited to the NHS (GP practices), very much akin to the SMS games or SMS car parking services that have since become mainstream. Alex has prolonged exposure to a broad range of disciplines in computing including networking, database design and deployment, web and Java development, cloud computing architecture, to name but a few. Since joining CloudSigma where he works as a Director of Research and Project Manager of EU Funding, where he has attained thorough expertise in the operation and development of data centre and cloud stack infrastructure.

Leave a Reply