Installing Docker on Ubuntu

Project status: complete

Objectives

Building an Ubuntu Host with Docker

I installed Ubuntu 16.04 LTS Server, on an Intel NUC, using the standard ISO image on a USB stick. Default configuration all the way, with DHCP networking.

To install Docker, I followed the instructions in the official documentation. First ensure APT uses HTTPS (it should already be installed with Ubuntu 16.04):

$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates

Then add the new GPG key:

$ sudo apt-key adv \
               --keyserver hkp://ha.pool.sks-keyservers.net:80 \
               --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Add the new APT source for Ubuntu 16.04:

$ echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list

Then update the APT package index:

$ sudo apt-get update

Verify that APT is pulling from the right repository:

$ apt-cache policy docker-engine
docker-engine:
  Installed: (none)
  Candidate: 1.12.5-0~ubuntu-xenial
  Version table:
     1.12.5-0~ubuntu-xenial 500
        500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
     [...]

Install the extra kernel packages:

$ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

We are now ready to install Docker:

$ sudo apt-get update
$ sudo apt-get install docker-engine

We can then start the docker daemon:

$ sudo service docker start

To verify that docker is installed correctly we can run the hello-world image:

$ sudo docker run hello-world