Docker Installation

The Docker is so new and constantly changing that even its official installation guide page for Ubuntu,, is not the simplest method. It’s not complicated at all, just that there are more simple ways out there that are not officially documented. So,

If you want to install Docker for Ubuntu, the easiest way is:

Docker installation for Ubuntu

# Install the cgroup dependency to avoid hassle later
sudo apt-get install cgroup-lite

#Add the PPA sources to your apt sources list.
sudo apt-get install python-software-properties && sudo add-apt-repository ppa:dotcloud/lxc-docker

# Update your sources
sudo apt-get update

# Install, you will see another warning that the package cannot be authenticated. Confirm install.
sudo apt-get install lxc-docker

NB, most installation guides hinted that cgroup is necessary but didn’t put it in the installation steps. If you don’t have cgroup pre-installed, you will get the following at the end of lxc-docker installation:

lxc-start: Error setting devices.deny to a for lxc/db597c3bd13b089294814d19fc0908bfa1ad15fbd2cb133d2d730912e9a47635

lxc-start: failed to setup the cgroups for 'db597c3bd13b089294814d19fc0908bfa1ad15fbd2cb133d2d730912e9a47635'
lxc-start: failed to spawn 'db597c3bd13b089294814d19fc0908bfa1ad15fbd2cb133d2d730912e9a47635'

Some side notes,

  • I first attempted to install Docker under Ubuntu 13.10, but get some strange errors, then I installed Docker under Ubuntu 13.04, which is the one used by Docker developers, and it went flawless.
  • Docker only support 64bit machines, and won’t install under 32bit hosts.

Docker installation for other distros

Docker installation for other distros can be as simple as:

curl -sL | sh

Of course, you’d better have the cgroup pre-installed as well.

This was actually what I did for my Ubuntu installation, because I was not aware of the above simpler method by then. It uses the following apt source, instead of the above PPA:

deb docker main

Test the Docker installation

Now we have Docker successfully installed, it’s time to do some testing:

# Verify the daemon is running and you can connect to it.
# If you see which version is running you know you are all set.
$ docker version
Client version: 0.5.3
Server version: 0.5.3
Go version: go1.1

$ docker ps
ID                  IMAGE               COMMAND                CREATED             STATUS

$ docker images
REPOSITORY          TAG                 ID                  CREATED             SIZE
busybox             latest              e9aa60c60128        7 months ago        6.825 MB (virtual 6.825 MB)

$ docker run busybox echo "Docker has been successfully installed"
Docker has been successfully installed

# To use a container image from someone else, find them online at, or by using:
$ docker search ubuntu
Found 22 results matching your query ("ubuntu")
NAME                DESCRIPTION
base                Another general use Ubuntu base image. Tag...
ubuntu              General use Ubuntu base image. Tags availa...
boxcar/raring       Ubuntu Raring 13.04 suitable for testing v...
creack/ubuntu       Tags:
crohr/ubuntu              Ubuntu base images. Only lucid (10.04) for...
. . .

# To download container images
$ docker pull learn/tutorial
Pulling repository learn/tutorial from
Pulling image 8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c (precise) from
Pulling image b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc (12.10) from ub
Pulling image 27cf784147099545 () from tutorial
# -- Docker has downloaded a number of layers. In Docker all images (except the base image) are made up of several cumulative layers.

# install a simple program (ping) in the container.
$ docker run learn/tutorial apt-get install -y ping
Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 56.1 kB of archives.
After this operation, 143 kB of additional disk space will be used.
Get:1 precise/main iputils-ping amd64 3:20101006-1ubuntu1 [5
6.1 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 56.1 kB in 1s (50.3 kB/s)
Selecting previously unselected package iputils-ping.
(Reading database ... 7545 files and directories currently installed.)
Unpacking iputils-ping (from .../iputils-ping_3%3a20101006-1ubuntu1_amd64.deb) ...
Setting up iputils-ping (3:20101006-1ubuntu1) ...
# -- Note that even though the container stops right after a command completes, the changes are not forgotten.
# -- Your changes to the filesystem have been kept, but are not yet saved.

# To save the changes, find the ID of the container you just created first
$ docker ps -l
ID                  IMAGE               COMMAND                CREATED             STATUS
6982a9948422        ubuntu:12.04        apt-get install ping   1 minute ago        Exit 0

$ docker commit 698 learn/ping
# -- Docker has returned a new ID. This id is the image id.

Once you start a process in Docker from an Image, Docker fetches the image and its Parent Image, and repeats the process until it reaches the Base Image. Then the Union File System adds a read-write layer on top. That read-write layer, plus the information about its Parent Image and some additional information like its unique id, networking configuration, and resource limits is called a container.

Docker container


Getting Started with Docker

Official Docker Installation Guide for Ubuntu


Docker is to deployment as Git is to development

Getting Started With Docker – Deploying ownCloud


4 thoughts on “Docker Installation

  1. If anyone know how to re-trigger the post installation script of lxc-docker, please comment. Thanks

  2. JFTA, when I didn’t have cgroup pre-installed, and tried to do lxc-docker installation, I got the aforementioned errors at the end of installation.

    So I removed the lxc-docker package and re-install it again. Furthermore, I even have done

    dpkg-reconfigure lxc-docker

    Just the installation and dpkg-reconfigure didn’t produce any output, which made me wondering if I have done anything wrong. But judging from the outcome, it seems to be working fine

  3. Pingback: Debian/Ubuntu Package Developing with Docker | SF-Xpt's Blog

  4. Pingback: Docker Image Amending | SF-Xpt's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s