How to Install Docker on Ubuntu 16.04

r00t July 28, 2017

Install Docker on Ubuntu 16.04

In this tutorial we’ll learn how to install Docker on Ubuntu 16.04. We will also install and configure its prerequisites. Docker is a container virtualization technology that has gained widespread popularity in recent times, it offers a more efficient way to deploy the application. With Docker, the applications reside inside the container on top of the Linux operating system. Docker uses Kernel features such as cgroups and namespace to allow an independent container to run on single os instance.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Docker on Ubuntu 16.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y && apt-get upgrade -y

Step 2. Installing Docker.

Add the key for the official Docker repository to your Ubuntu system:

sudo apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Add the GPG key for Docker repository on your system:

sudo apt-add-repository 'deb ubuntu-xenial main'

Run the following command to make sure that you install the latest version of Docker you just added, not the default Ubuntu one:

apt-get update
apt-cache policy docker-engine

Now, install the Docker using the following command:

apt-get install docker-engine

Start Docker service using the following command as per your operating systems. Also, enable Docker service to auto start on system boot:

systemctl enable docker
systemctl start docker

Step 3. Deploying your first Docker image, “Hello World!”.

You can use the handy hello-world test to verify whether or not Docker will run on your system:

docker run hello-world

You will get the following output:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world

42745667786f6: Pull complete
a3ede3f7veb02: Pull complete
Digest: sha256:4f32210e234b4ad5cac92BMWE46476c754fSEMANGAT8e5a8ba
Status: Downloaded newer image for hello-world:latest

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.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:

For more examples and ideas, visit:

Congratulation’s! You have successfully configured Docker on your Ubuntu 16.04 LTS server.

The Tags:

Leave a Comment

Comments are closed.