Search at Knowledgebase
How to install Docker on Ubuntu 18.04

Objective

Docker is a software platform developed to facilitate the deployment of applications based on the concept of containers. The platform can be used to create, test and distribute applications by collecting them in standardized units, called containers.

Docker containers are isolated environments where applications can be run with no interference by other processes. Similarly to what happens with virtual machines, specific computational resources are allocated to each container. Unlike Virtual Machines, Docker does not require any hardware emulation but uses the physical hardware of the host for each container.

Being resource-efficient and able to generate improved system performance, containerization can be seen as the natural evolution of virtualization. Moreover, as they feature whatever needed for the correct execution of the applications – including libraries, system tools and codes – containers simplify the deployment of an application with no need to worry about the configuration of the runtime environment.

In order to install Docker, first connect to your server via an SSH connection. If you haven’t done so yet, following our guide is recommended to connect securely with the SSH protocol. In case of a local server, go to the next step and open your server terminal.

Docker installation

To get the latest version of Docker, download it from the Docker Repository and not from the official Ubuntu Repository. Let’s see how to do so.
Update the list of packages with the command:

$ sudo apt update

Install some packages in order to allow apt to use packages on HTTPS

$ sudo apt install apt-transport-https ca-certificates curl software-properties-common

Add the GPG key from the Docker Repository to your system

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker Repository to the APT sources

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

Update the database of packages with the newly added Docker packages

$ sudo apt update

Make sure the installation is using the Docker Repository and not the one from Ubuntu one with the command:

$ apt-cache policy docker-ce

Finally, install Docker:

$ sudo     apt install docker-ce

Now Docker is installed, the Daemon should be running and the process should be enabled to run on start-up. To verify that it is running, use the command:

$ sudo systemctl status docker

Adding your user to Docker group

To avoid typing the “sudo” command every time, add your user to the docker-group. The docker-group is a group of users enabled to execute commands as if they were administrators.

$ sudo usermod -aG docker ${USER}

N.B. You can add other users to the docker-group by simply executing this command for each user you want to add
To re-access and apply changes, type the following command:

$ su - username

After executing this command enter the user’s password to continue.
To learn how to use containers and images with Docker, we recommend reading our guide on how to manage Docker containers on Linux.

Your FREE Trial Starts Here!
Contact our Team for Application of Dedicated Server Service!
Register as a Member to Enjoy Exclusive Benefits Now!
Your FREE Trial Starts here!
Contact our Team for Application of Dedicated Server Service!
Register as a Member to Enjoy Exclusive Benefits Now!
Telegram Skype