NeXtMidas Training

Docker Installation


How To Install Docker

At first, docker was only available on Ubuntu. Nowadays, it is possible to deploy docker on RHEL based systems (e.g. CentOS) and others as well.

Let's quickly go over the installation process for Ubuntu.

Note: Docker can be installed automatically on your Droplet by adding this script to its User Data when launching it. Check out this tutorial to learn more about Droplet User Data. Installation Instructions for Ubuntu

The simplest way to get docker, other than using the pre-built application image, is to go with a 64-bit Ubuntu 14.04 VPS

Update your droplet:

sudo apt-get update
sudo apt-get -y upgrade
		


Make sure aufs support is available:

sudo apt-get install linux-image-extra-`uname -r`
		


Add docker repository key to apt-key for package verification:

sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
		


Add the docker repository to Apt sources:

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


Update the repository with the new addition:

sudo apt-get update
		


Finally, download and install docker:

sudo apt-get install docker-engine
		


Ubuntu's default firewall (UFW: Uncomplicated Firewall) denies all forwarding traffic by default, which is needed by docker.

Enable forwarding with UFW:

Edit UFW configuration using the nano text editor.

sudo nano /etc/default/ufw
		


Scroll down and find the line beginning with DEFAULTFORWARDPOLICY.

Replace:

DEFAULT_FORWARD_POLICY="DROP"
		


With:

DEFAULT_FORWARD_POLICY="ACCEPT"
		


Press CTRL+X and approve with Y to save and close.

Finally, reload the UFW:

sudo ufw reload
		


For a full set of instructions, check out docker documentation for installation here.