Install Docker on Ubuntu-16.04

For ones, who want to build and run Docker containers on Ubuntu-16.04 – first of all it is required to install Docker itself.

To install the latest version of Docker and to be able to upgrade it easily in future – it is recommended to install Docker from the official repository.

In this guide i will show how to install free Docker CE (Community Edition) on Ubuntu-16.04 from the stable official repository, how to verify that it is installed correctly and will show the common post-installation steps to perform.

Requirements: To install Docker on Ubuntu-16.04 – you must have 64-bit architecture and Linux kernel version 3.10 or higher. You can check if your system matches the requirements with the arch and uname -r commands.

Install Docker on Ubuntu-16.04

Add Docker’s official GPG key:

$ curl -fsSL | sudo apt-key add -

Verify that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88:

$ sudo apt-key fingerprint 0EBFCD88

Set up the stable Docker’s repository:

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

Install Docker:

$ sudo apt-get update
$ sudo apt-get install docker-ce

Start Docker:

$ sudo systemctl start docker

Verify that Docker is installed correctly by running the hello-world image:

$ sudo docker run hello-world

Cool Tip: Docker successfully installed! It’s time to run first container! Read More →

Post-Installation Steps

Once Docker is installed, there are few more things left to do.

First of all it is required to configure Docker daemon to start automatically at system boot.

Run the following command to add Docker to autostart:

$ sudo systemctl enable docker

And secondly, add your user to the docker group to get rid of the need of typing sudo each time you run the docker command:

$ sudo usermod -aG docker $USER

Info: Log out and log back to complete the group assignment.

To verify that you can run docker without sudo, execute:

$ docker run hello-world
Was it useful? Share this post with the world!

2 Replies to “Install Docker on Ubuntu-16.04”

  1. just

    $ sudo curl | sh
    1. Using this script is not recommended for production environments, and you should understand the potential risks. This command gives direct root access to your system and there is no guarantee that the content of the installation script hasn’t been maliciously modified on the server. It is more safer to install Docker on Ubuntu through manually configured apt repository signed with GPG.

Leave a Reply