Docker: Installing Docker CE on Ubuntu 14.04

Docker is a container platform that streamlines software delivery and provides isolation, scalability, and efficiency with less overhead than OS level virtualization.

These instructions are taken directly from the official Docker for Ubuntu page, but I wanted to reiterate those tasks essential for installing the Docker Community Edition on Ubuntu 14.04.

Uninstall older versions

$ sudo apt-get remove docker docker-engine

Install extra packages

$ sudo apt-get update

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

Setup Docker Repository

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \

$ curl -fsSL | sudo apt-key add -

$ sudo add-apt-repository \
   "deb [arch=amd64] \
   $(lsb_release -cs) \

Install Docker Community Edition

$ sudo apt-get update

$ sudo apt-get install docker-ce

The above command installs the Docker engine and client.  If you just want the Docker client, see the section further down.  Docker logs can be found at “/var/log/upstart/docker.log” since Ubuntu 14.04 uses upstart.

Validate Install

$ docker --version
Docker version 17.03.0-ce, build 3a232c8

$ sudo docker run hello-world

The docker run command from above should return a message like:

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

Docker via TCP

By default, the docker daemon listens on a local unix port owned by root (/run/docker.sock) which means your docker client will only work from the installed server and as sudo.  If you want to access the docker instance remotely, you need to modify ‘/etc/default/docker’ and modify the options so that TCP is the standard port:

DOCKER_OPTS="-H tcp://"

Make sure the firewall allows this port, and restart the service:

$ sudo ufw allow 2375/tcp

$ sudo service docker restart

Then use the DOCKER_HOST environment variable to inform the docker client where you wish to connect:

$ export DOCKER_HOST="tcp://"

$ docker ps -a

The export statement can be appended to “~/.profile” and sourced to take affect upon every login.

One side-effect of using the TCP port and not the root-owned local unix port, is you no longer need to prefix docker client commands with ‘sudo’.  However, you lose the auditability provided by sudo logging the command and parameters (‘/var/log/auth.log’ on Ubuntu).

Docker Client Only

Clearly, if you have a client-only install, then you need to read the above section first because your remote Docker engine needs to be listening, and your client host needs DOCKER_HOST to point to the remote Docker engine.  You cannot reach the Docker engine with a unix port.

If you need to install the Docker client only, and not the full Docker engine, then you have to do a manual download of the release archive, and extract the binary as described here.

$ mkdir -p /tmp/download && \
 curl -L | tar -xz -C /tmp/download && \
 rm -rf /tmp/download/docker/dockerd && \
 sudo mv /tmp/download/docker/docker* /usr/local/bin/ && \
 rm -rf /tmp/download

$ docker --version
Docker version 17.03.1-ce, build c6d412e

The exact archive name for your desired version can be pulled from the release list.

 Docker Compose

If you want to install docker-compose, you can do so with Python’s pip “sudo pip install docker-compose”, but you are going to get an older version.  It is better to install the latest release (check for the latest version here).

$ sudo curl -o /usr/local/bin/docker-compose -L "$(uname -s)-$(uname -m)"

$ sudo chmod +x /usr/local/bin/docker-compose

$ docker-compose -v
docker-compose version 1.13.0, build 1719ceb