The best way of installing Docker on Linux

The best way of installing Docker is achieved when our criteria for Docker installation exist; these criteria include the following:
Docker installation best practice
1. Installing the latest version of Docker
The latest version is not necessarily the most secure version; the features included in the latest update may provide higher access for the hackers. However, its advantage over the other versions is that the old versions have several specific bugs.
When a (amateur or professional) hacker wants to review the system bugs, he/she first uses the specific and known bugs.
So, the most important criterion is the latest version of Docker.
2. Quick installation
Installation with the minimum commands and the least complexity is one of the favorable ways of installation for the server managers. As a server manager, you may need to set up various servers or install and configure various services. It is not rational to spend a lot of time for each service.
So, we use scripts or software such as Ansible for installing the services.
3. Easy installation on all the Linux distributions
If you have worked with different distributions of Linux, you have found that the software such as nginx can be installed in different ways in each Linux distribution.
yum install nginx
apt install nginx # or apt-get install nginx
The best way of installation
Regarding the above-mentioned factors, the best way of installation is to use the script provided by the Docker. This script can be installed by a download tool such as wget or curl.
In this way, the Docker is installed with a one-line command, and the latest version of Docker is installed on your server.
Note that you can install the Docker on Ubuntu servers by the following command; however, most of the Ubuntu repositories do not have the latest version of the software.
apt install docker.io
This script supports the following Linux distributions:
Debian — Ubuntu — Raspbian — CentOS — Redhat — Fedora
How to use the script
Using this script is so simple.
You can view and download this script from get.docker.com.
Quick installation of Docker in Linux can be done by the following command.
wget get.docker.com -qO - | sh
With curl
curl -sSL get.docker.com | sh
After running, wget command usually provides some information about the server to be connected to that, the connection time, redirects, and downloads. This information cannot be observed by –q.
-O is used for saving the website contents in a file; however by inserting — after that, the information appears in the output instead of the site.
In curl command, sS is used for not showing the unwanted information. –L is used for tracing the website route.
For example, get.docker.com is redirected to https://get.docker.com.
If we do not use –L, the output will be null.
The second part of both the commands are the same; so that, | sh passes the output of the first command to sh command. So, the commands in the script are processed and run by Linux Shell one by one.


