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):[bash] #cloud-config
– 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.
- Line 2: Upgrade all packages and brings the system up to date.
- Line 3: If the updates on line one requires a reboot, go ahead and do it.
- Line 4-5: Tell the system to install the public SSH key (Your-Public-SSH-Key) to the user ‘ubuntu’
- Line 6-7: Install the package ‘docker.io’. This also implies ‘package_update: true’.
- Line 8-10: Usability enhancement from the official installation guide.
- Line 11: 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 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:[bash light=”true”] $ ssh email@example.com "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.
Share this Post
- Manage Docker resources with Cgroups - May 12, 2015
- Docker, Cgroups & More from ApacheCon 2015 - April 30, 2015
- How to setup & optimise MongoDB on public cloud servers - March 24, 2015
- Presentation deck from CloudExpo Europe - March 17, 2015
- CoreOS is now available on CloudSigma! - March 10, 2015