Sitemap

Install Docker

2 min readOct 25, 2016

--

This blog describes the installation procedure for Docker — the stable version, and the experimental version, and instructions to compile docker from source.

“The below Instructions have been tested on Ubuntu Trusty Tahr (14.04) and Ubuntu Xenial Xerus (16.04) “

Prerequisites:

  • Ubuntu 14.04 or Ubuntu 16.04 is needed
  • Linux kernel >=4.3 (Go here for instructions to update)
  • A working installation of Go Lang to compile from source (instructions here)

Step-by-step guide : Docker — Stable ( latest)

1. Install the prerequisites.

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

2. Add the keys to docker’s repositories

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

3. Add the docker repository to the sources.

sudo vi /etc/apt/sources.list.d/docker.list"deb https://apt.dockerproject.org/repo ubuntu-trusty main" ( if on ubuntu 14.04)"deb https://apt.dockerproject.org/repo ubuntu-xenial main" (if ubuntu 16.04)

4. Update sources, and install the extra kernel modules

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

5. Install the docker-engine

sudo apt-get install docker-engine

6. Start the docker service

sudo service docker start

7. To be able to run docker without sudo, do the following

sudo groupadd docker
sudo usermod -aG docker $USER

8. Open /etc/defaults/docker , and append “ — dns 8.8.8.8” to resolve any dns related issues.

Get Tarun Chinmai’s stories in your inbox

Join Medium for free to get updates from this writer.

9. Reboot for the changes to take effect.

Step-by-step guide : Docker — Experimental ( latest)

Method 1:

  1. The easiest way to install docker experimental version, is to install the stable version, and then do the following. The automated script will install all the necessary packages and dependencies.
curl -sSL https://experimental.docker.com/ | sh

Method 2:

  1. Install the stable version.

2. Download the experimental binaries , and unpack them to /usr/bin

wget -O docker.tgz https://experimental.docker.com/builds/Linux/x86_64/docker-latest.tgzsudo service docker stopsudo rm -rf /usr/bin/docker*sudo tar xvf docker.tgz -C /usr/bin/sudo service docker start

Verify if the experimental binaries were correctly installed,

docker version

Check if both the client and server have the “ Experimental : True “ flag.

Step-by-step guide : Docker — compile from source ( Bleeding edge )

The experimental binaries are often behind the master branch by about a week, and if there’s a need to have the latest, features, docker has to be compiled from source.

  1. To compile docker from source, you need to install Go Lang ( instructions here ) and Git. (sudo apt-get install git)
  2. A Working installation of docker is needed to compile docker from source., so install the stable build (kinda ironic)

3. Clone the repo,and make. Get some coffee. It’ll take a lot of time.

git clone https://github.com/docker/docker.git docker
cd docker
make binary (for a stable build)
DOCKER_EXPERIMENTAL=1 make binary (for the experimental build)

4. The binaries can be found in docker/binaries. Move them to /usr/bin to replace the existing docker installation.

References :

http://docs.master.dockerproject.org/

--

--

Tarun Chinmai
Tarun Chinmai

Written by Tarun Chinmai

Software Engineer, Occasionally dabbing in Infosec