So my background is in VMware virtualisation, but I hear the buzz these days is that I may as well forget everything I know, and that it’s all about containers! 🙂
Joking aside, containers definitely compliment virtualisation, giving you more portability, granular control, and the flexibility to spin up new application instances in milliseconds. For an excellent introduction to docker and containers I recommend you check out Greg Ferro’s post here. I decided it was about time I had a bit of a play with Docker, and at the same time I thought I may as well document my process and some of the basics for any others in the same position. I will try to keep each post as short as possible, breaking things down into manageable chunks (whilst avoiding the dreaded TLDR!).
Most of my recent Linux experience is with Ubuntu, which works out quite well as apparently this is the preferred distro for a very large proportion of Docker users and images. CoreOS is a very interesting proposition too, but one step at a time…
All of the examples in this post and series are based on:
- Ubuntu 14.04.1 LTS
- Docker 1.2.0
I find it very interesting to note the rate at which the docker development team are providing new releases.
- Docker 1.2.0 22 Aug 2014
- Docker 1.1.0 03 Jul 2014
- Docker 1.0 09 Jun 2014
- Docker 0.9 10 Mar 2014
- Docker 0.8 04 Feb 2014
- Docker 0.7 26 Nov 2013
- Docker 0.6 23 Aug 2013
Not only are they very often, but that appear to be accelerating, with a new point release every month for the last three! This is great as it means more features, bug fixes etc, but it also means that anything you develop and test today may already be out of date by the time you come to deploy it to production next month! Docker’s official line on long term support can be found here, but from the look of it you will never be allowed to fall more than 12 months behind. This suggests that the aggressive release schedule to date is likely a pattern that will continue for the foreseeable:
https://www.docker.com/enterprise/support/
Before you follow any of the steps below, I also highly recommend you check out the link below for your first taste of using the Docker CLI:
https://www.docker.com/tryit
If like me, you like to look up a decent book on a subject to help you get your head around it, I also suggest checking out one of the first publications on the subject (I’m reading it at the moment and will try to get a review done once finished):
The Docker Book: Containerization is the new virtualization
So as for the install, it really is incredibly simple. Personally I like to always create my Ubuntu Server VMs as “Minimal” installs. This is simply done by hitting F4 during base OS install. I’ll assume you can do the basic config of your Ubuntu VM by configuring a static IP address, hostname, DNS, installing VMware tools, completing the latest system updates, etc.
The install process is also detailed here:
https://docs.docker.com/installation/ubuntulinux/
To ensure you have your repositories fully up to date:
sudo apt-get update
One you have docker installed log into the console and run the following to install docker and its dependencies:
sudo apt-get install docker.io sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker sudo sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io
I would prefer using the latest version of docker, which means some extra commands:
sudo apt-get install apt-transport-https sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 sudo sh -c "echo deb https://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list" sudo apt-get update sudo apt-get install lxc-docker
As per my previous post you also need to do:
sudo apt-get install apparmor
Check your upgrade has worked by confirming the current version:
sudo docker version
Then you can test the install by creating your first container:
sudo docker run -i -t ubuntu /bin/bash
That’s it!
In the next post I will describe the ways to remove all of the containers you will inevitably create now that you can see the awesome power of Docker! 🙂
http://www.tekhead.org/blog/2014/09/docker-part-2-howto-remove-delete-docker-containers/