Docker is an open-source technology where it is used for deploying applications through containers. It allows a more transparent method of communication and the requirement of using it is usually light enough to fit into any Linux based VPS project. In this article, you will be able to learn how to install Docker onto your VPS. The Linux distribution used for this guide is Ubuntu 18.04.
Step 1: Update System
Firstly, connect to your VPS using the SSH with root access. Despite the fact that Docker isn’t included in the official Ubuntu repositories, it doesn’t make the installation any harder. It is recommended to update your system for the installation to run more smoothly. To update your system, use the following commands one by one.
sudo apt update
sudo apt upgrade
Step 2: Prerequisite Packages Installation
After updating the system, to install Docker, some necessary packages need to be installed to meet the Docker requirements. To summarize what needs to be installed, you can install all of them using the following command.
sudo apt-get install curl apt-transport-https ca-certificates software-properties-common
To explain what the packages installed are, “apt-transport-https” allows the package manager to transfer files and data over https, “ca-certificate” allows checking security certificates by the web browser and system. “curl” for data transferring and “software-properties-common” managed software by adding scripts.
Step 3: Add Docker Repositories
Now, in order to simplify the installation process, we will first add the docker repositories into the system. It enables the official method of installation. To do so, first, add the GPG key using the following command.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
Following on, add the docker repositories for Ubuntu using the following command.
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
Then update the repository information.
sudo apt update
To make sure the installation is from Docker repositories instead of Ubuntu repositories, use this command.
apt-cache policy docker-ce
You will have an output where you could see the version number installed in your system, but the installed state of docker-ce is none, which means it is not installed yet.
Step 4: Docker Installation
Now that the repositories are there, you may begin installing Docker using the following command.
sudo apt install docker-ce
Step 5: Verifying Installation
After your installation is complete, it is recommended to verify if the installation is successful. To do so, check the status of the service using the following command.
sudo systemctl status docker
With this, your Docker installation on Ubuntu 18.04 is completed. If any problem arises, try to retrace the previous steps.