Serverspace Black Friday
JT
July 8, 2024
Updated July 12, 2024

How to install Docker on Debian?

Debian VPS

The era of one server - one service ended with the advent of virtualisation, when it became possible to create isolated environments on a device. In general, this technology allows you to isolate resources and processes at the level of both the processor and the OS kernel. Today we are going to talk about the second one, this technology is a set of solutions on the OS, with the help of which the environment is isolated.

What is Docker?

Docker is a platform of services that create separate spaces in the OS through namespace, cgroups and mapping mechanisms, providing independent software spaces or containers. To ensure cross-platform compatibility, a pre-prepared distribution with minimum requirements for application operation is used. And the software itself is packaged in images that can be unpacked quickly and easily with all dependencies.

How to install Docker quickly?

For a flexible and fast installation, you should first check the version of the distribution, preferably use Debian 11-12. Call the utility with the command below and filter the output:

dmesg | grep 'Debian'
Version of OS
Screenshot №1 — Version of OS

In our case, version 12.2, which fits the installation requirements! If your distribution is outdated, it is advisable to upgrade to Bookworm or Bullseye.

Please note that all actions must be performed as root, or as a user with sudo group rights for correct installation and use. In the future, if necessary, you can set permissions for a normal user to work only with the docker utility.

.

Let's update the repository and download the necessary utilities for work:

apt update && apt install curl nano ca-certificates -y
Dependencies
Screenshot №2 — Dependencies

After the necessary software has been downloaded, let's move on to installing Docker repositories and the platform itself. To verify the integrity and authenticity of packages, gpg-keys are used, which should be downloaded from the official website and placed in the /etc/apt/keyrings directory:

mkdir -p /etc/apt/keyrings &\
chmod 755 /etc/apt/keyrings &&\
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc &&\
chmod 444 /etc/apt/keyrings/docker.asc
 
Key of repo
Screenshot №3 — Key of repo

Note that this is the most important point from the point of view of security of packages that will be installed. After all, if the intruder substitutes his own key, further verification will be meaningless. Therefore, make sure that you have an HTTPS connection with a correct certificate that specifies the organisation. Also don't forget to check the hash values of keys on the site and when you receive them on the distribution.

Then we can move on to the configuration of the repository record itself in the files of the package manager, for this we will write the command:

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list
Record of repo
Screenshot №4 — Record of repo

All steps in the tutorial can be performed on powerful cloud servers. Serverspace provides isolated VPS / VDS servers for common and virtualize usage.

Create Server
Screenshot №5 — Create Server

It will take some time to deploy server capacity. After that you can connect in any of the convenient ways!

And now that the key is downloaded and the repository is prescribed you need to update and install the packages:

apt update && apt install docker-ce docker-ce-cli containerd.io
Installation
Screenshot №6 — Installation

And at the end of the installation, you need to run the platform autoloader as desired:

sudo systemctl enable docker.service
sudo systemctl enable containerd.service
systemctl status docker
Docker daemon status
Screenshot №7 — Docker daemon status
Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.