July 21, 2014 - 5:20 pm. Posted by Viktor Petersson
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 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 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.
Now paste in the following and press ‘Activate’ (and then save your server):
#cloud-config package_upgrade: true package_reboot_if_required: true ssh_authorized_keys: - Your-Public-SSH-Key packages: - docker.io runcmd: - ln -sf /usr/bin/docker.io /usr/local/bin/docker - sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io final_message: "Your Docker server is now ready."
If you’re not familiar with CloudInit, let’s run through what this does.
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). As a result, you may not see the final message.
After CloudInit is done, you should now be up and running with Docker:
$ ssh firstname.lastname@example.org "sudo docker ps" CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
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.