Docker – Installing Docker on Ubuntu Trusty 14.04

Docker has been on my list of things to have a closer look at for a while now, this being the first of what should be a series of posts on it. Docker is an application container that allows an application to be packaged inside a virtual container so that it can be run across different Linux distros.  Docker offers an alternative to server virtualisation, running application containers instead of running full virtual machines.

The concept of application ‘containers’ has been around for quite some time. Solaris Zones, for example, existed over 10 years ago. A container can hold applications and dependancies such as configuration files, however, unlike a virtual machine, a container doesn’t run a OS, it shares the OS of the host, which in this case will be Ubuntu 14.04.

Because the OS isn’t part of the container, a docker container can be faster and less demanding than a virtual machine (or bunch of virtual machines). Whilst a virtual machine can take a while to provision, and then configure, a container can be started in a matter of seconds. However, the other side of this is that due to containers sharing the same common OS, there isn’t the same isolation that you have with virtual machines. 

Installing Docker on Ubuntu using the Ubuntu Docker Package

Docker is supported to run on the following versions of Ubuntu:

  • Ubuntu Trusty 14.04 (LTS) (64-bit)
  • Ubuntu Precise 12.04 (LTS) (64-bit)
  • Ubuntu Raring 13.04 and Saucy 13.10 (64 bit)

In my lab I have set up a new install of Ubuntu Trusty 14.04, which is running as a virtual machine on ESXi 5.1. So far, I haven’t done anything to the Ubuntu VM other than give it an IP address and install VMware Tools. To install the most recent Docker Ubuntu package, run:

$ sudo apt-get update
$ sudo apt-get install docker.io

The installer will then download the files and apply them to your Ubuntu system. Bear in mind that this is the Ubuntu Docker package, which will not be the latest version. If you want to install the latest version of Docker, follow the next section.

Installing the Docker-maintained Package on Ubuntu

This section will go through installing the Docker maintained Docker package on Ubuntu. This is the most recent version of Docker, so my future posts will be based on a system running this version. The installation is a bit more involved than with the Ubuntu package. To start, you need to ensure that your host’s APT can handle https downloads. If it does then the file ‘/usr/lib/apt/methods/https‘ should exist:

This file existed by default on my Ubuntu 14.04 installation, so if you are using the same version you shouldn’t run into any issues here. Next, you need to add the Docker repository to your host’s key chain, as documented here:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

Next, add the Docker repository to your hosts APT sources list, then update APT:

$ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
sudo apt-get update

When the update runs you should now see Docker packages listed in the output:

Finally, we’re ready to install the Docker maintained package:

sudo apt-get install lxc-docker

We can confirm it’s installed by checking the version:


user@docker-vm:~$ sudo docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): linux/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8

And that’s it for installing Docker on Ubuntu. Look out for more posts on Docker where I’ll have a look at what it can do!

Useful Links and Resources

https://docs.docker.com/installation/ubuntulinux/

Related posts

VMware vSphere Virtual Machine Snapshots Explained

Understanding Type 1 and Type 2 Hypervisors

How to Enable SSH on All ESXi Hosts using PowerCLI

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More