AMZ DIGICOM

Digital Communication

AMZ DIGICOM

Digital Communication

Debian 11: install Docker on the Linux system

PARTAGEZ

THE docker engine works natively on Linux and can be used with different servers. Learn how to install Docker on Debian 11 and which server types are best suited for each usage scenario.

Installing Docker on Debian 11: what conditions?

Unlike virtual machines, Docker containers are lightweight, with low hardware requirements. However, the more complex your application, the more the memory requirement of the container as well as the use of other resources are important. To install Docker on Debian 11, the system requirements are as follows:

  • Processor (CPU) : x86-64 architecture, 2 GHz minimum (single core)
  • Memory (RAM) : 2 GB minimum (for Docker application with GUI, the minimum is 4 GB of RAM)
  • Operating system: Debian 11 (Bullseye), user with root rights
  • Core : 4.19 or higher, with support for cgroups, namespaces, overlay filesystems and Seccomp filters
  • Hard disk space : 20 GB minimum
  • Internet connection : for downloading images and Docker packages

Docker Hosting: Dedicated Server, Cloud Server, or Virtual Dedicated Server (VPS)?

It is possible to rent different models of servers to use Docker on Debian 11. The prices charged by the providers depend on the hardware used, the architecture and the performance sought. Typically, there are three types of servers to choose from:

  • Dedicated server
  • Cloud Server
  • vServer/VPS

A dedicated server is exclusively reserved for you, which has certain advantages. With some dedicated hardware, you can access more resources than with a VPS or cloud server. Costs are higher, but performance is higher thanks to hard disk space, RAM and additional processor cores. By exercising full control over the Debian server, you can protect the container environment against threats in a more targeted way. In addition, you have the option of setting up pre-customized tools and configurations.

The dedicated servers offered by IONOS always offer you more flexibility and performance for your business solution, with per-minute billing.

Cloud servers are made available to you through a network. In addition to being extremely scalable, they rarely fail. In addition, only the real time of use of your Cloud server is billed to you.

With one of the cloud servers offered by IONOS, you can benefit from the Docker engine at a favorable price and in a virtual infrastructure.

Unlike dedicated hardware, a virtual server shares performance on a physical server system. Thus, a VPS is therefore particularly suitable for small containers or medium-sized containers.

By renting one of the VPS made available by IONOS, take advantage of the advantages offered by Docker at a fixed monthly price.

Possible usage scenarios for Docker on Debian 11 and corresponding IONOS servers

It is not uncommon for the search for the perfect server to take a lot of time. Even if you already know the different types of servers offered by IONOS, it can be difficult to find the most suitable offer. For your convenience, below are three typical usage scenarios, along with the IONOS servers that correspond to each of them.

Second Server Recommendation Usage scenario First Server Recommendation
Cloud Server S Small website or small database, simple application development and testing VPS-M
VPS-L Continuous integration and continuous deployment (CI/CD), larger websites, microservices architecture M Cloud Server
XL Cloud Server Enterprise applications, busy websites, backup solutions for large volumes of data AR6-32 SSD

Step-by-step instructions: How to install and use Docker on Debian 11?

Once your server solution has been chosen, you can begin the installation. Below is how to provision Docker on your Debian 11 server.

Start by making sure you’re using the latest version of Docker by downloading the installer package from the Docker repository. Open your Debian system’s terminal and run the commands you’ll find below.

Step 1: Update package list

Start by updating the package index of already installed repositories:

Step 2: Install necessary packages

In the next step, you will set up other package dependencies for the Docker installation:

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

bash

Step 3: Add the GPG key for the Docker repository

The “curl” command allows you to download the GPG key from the official Docker repository. This way you can be sure that your packages for Docker come from a reliable source:

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

bash

Step 4: Add the Docker repository

Now add the Docker repository to the Advanced Packaging Tool (APT) « Sources » file, which contains a list of all repositories:

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

bash

Step 5: Update package list

Once this new repository is added, the package index should be refreshed again to ensure that package information is up-to-date across all repositories:

Step 6: Check cache policy

Access the cache policy and verify that the available installer packages are from the official Docker repository and were not downloaded from Debian:

$ apt-cache policy docker-ce

bash

Step 7: Install Docker

You can now install Docker using the following command:

$ sudo apt install docker-ce

bash

Step 8: Test the state of Docker

To ensure that Docker is working effectively, you can check its status by entering the following command:

$ sudo systemctl status docker

bash

Step 9: use the “docker” command

As the name suggests, the « docker » command allows you to run commands in Docker. In addition to the main command, options, subcommands and arguments are available:

$ docker [option] [command] [arguments]

bash

Step 10: Display the list of subcommands

To view the list of subcommands, just run the « docker » command in the terminal:

Below is part of the list of subcommands supported by the “docker” command:

Terminal: list of subcommands
Terminal: list of subcommands.

Containers are created using a Docker image, available on the “Docker Hub” site. Use the “pull” subcommand to download the image. Your container forms based on it. To execute commands in a container, it is necessary to fill in the command “docker run” and the corresponding image in the command line.

Variation: run Docker without root rights

For security reasons, it may be a good idea to run Docker without root rights after successful installation. To do this, simply create a group called « Docker » in your system, and add the desired users to it. All you need to do is use the terminal commands below:

sudo groupadd docker
sudo usermod -aG docker $USER

bash

Warning: “$USER” is only a wildcard character. You must replace it with the name of the user you want to add.

Télécharger notre livre blanc

Comment construire une stratégie de marketing digital ?

Le guide indispensable pour promouvoir votre marque en ligne

En savoir plus

Souhaitez vous Booster votre Business?

écrivez-nous et restez en contact