Install Docker on Ubuntu 16.04 Xenial Xerus

In this tutorial, we will see how to install the official version of Docker on Ubuntu 16.04 Xenial Xerus in a simple and fast way.

Included in Ubuntu 16.04 Xenial Xerus is already available version 1.6.1 of Docker packaged for deployment, but in this article, we will find out how to install the version available on the site that is up to date.

Ubuntu Xenial installation is pretty easy: the first thing to do is update the list of packages in your distribution.

Then add Docker’s repository key to your operating system.

Add official stable Docker repositories.

update the system by issuing the following command,

Make sure docker official repositories are added and used instead of default Ubuntu.

You will receive following output whcih shows that official resposatories are used for docker,

Now we install Docker

At this point docker group automatically added to our system. All you need to add your desired user with sudo power to run the docker without typing sudo every time. Change “mani” with your username.

Activate OverlayFS for Docker on Ubuntu 16.04 Xenial Xerus

This step is completely optional but allows you to use Docker with a different driver and file system than the standard ones.

If you wish, you can use a different disk for Docker images and containers. Suppose you want to keep the root filesystem separate from the image files and containers.

Prepare the new disk by creating a new partition by replacing sdb with the device you decided to allocate to Docker:

Once you’ve created the partition, format it with the ext4 format.

We create the /var/lib/docker/overlay folder

Now insert in the /etc/fstab file the necessary information for the disk to be mounted in the folder at each reboot of Ubuntu 16.04.

Add the line

Let’s remember to replace /dev/sdb1 with the partition created for Docker or with the UUID assigned to that partition.¬†You can find out the UUID using the command:

I show you how my file /etc/fstab was made after editing:

At this point, we mount the file system.

Then open the /etc/default/docker file to indicate that you use overlay and custom folder.

Insert the following line at the bottom of the file:

We save the file.

Let’s restart Docker.

Authored By Imran Yousaf

I am Imran Yousaf, a computer geek, founder of the site I am a die hard fond of open-source software and Linux operating system. In addition to Linux, I am interested in everything related to information technology and modern science.

Leave a Reply

Your email address will not be published. Required fields are marked *