docker with cloudinit

How to run Docker on CloudSigma (with CloudInit)

First, you need to have knowledge of a few pre-requisites:

In the recent year or so, Docker has received a tremendous amount of attention. It appears to be one of those things where the timing was just perfect. While the concept of containers is hardly anything new (which I talked more about in this previous post), Docker appears to have become the go-to container manager.

Assuming you’re already familiar with the basics of the container manager, 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 Cloud Image” in the Marketplace).

Once you’ve cloned this and created a server with this image, go ahead and resize it. The template image is just slightly larger than 2GB, which isn’t sufficient for this. 5-15GB is more suitable.

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

Docker with cloudinit

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

[bash] #cloud-config
package_upgrade: true
package_reboot_if_required: true
– Your-Public-SSH-Key
– ln -sf /usr/bin/ /usr/local/bin/docker
– sed -i ‘$acomplete -F _docker docker’ /etc/bash_completion.d/
final_message: "Your Docker server is now ready."

If you’re not familiar with CloudInit, let’s run through what this does.

  • Line2: Upgrade all packages and brings the system up to date.
  • Line3: If the updates on line one requires a reboot, go ahead and do it.
  • Line4-5:  Then, tell the system to install the public SSH key (Your-Public-SSH-Key) to the user ‘ubuntu’
  • Line6-7: After that, install the package ‘’. This also implies ‘package_update: true’.
  • Line8-10: Usability enhancement from the official installation guide.
  • Line11: Finally, display a message when done.

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, your server may or may not reboot (Line 3 above). As a result, you may not see the final message.

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

[bash light=”true”] $ ssh ubuntu@a.b.c.d "sudo docker ps"

Finally, you now have a server up and running. This can of course be automated using our API too, in case you need to create multiple servers.


About Viktor Petersson

Former VP of Business Development at CloudSigma. Currently CEO at WireLoad and busy making a dent in the Digital Signage industry with Screenly. Viktor is a proud geek and loves playing with the latest technologies.