How to install Docker on Debian 12

Debian is one of the most popular Linux distributions for server applications due to its stability and security. We’ll explain how to install Docker on Debian.

How to install Docker on Debian 12 depending on system preferences

Docker itself doesn’t require much hardware power, but complex applications can use a significant amount of system resources. Before installing, ensure that your system meets the following minimum requirements:

  • Operating system: Debian 12
  • Processor: 64-bit CPU, min. 2 GHz with KVM support
  • RAM: 4 GB
  • Desktop environment: Gnome, KDE or MATE
  • Other software: QEMU 5.2 or better

You also need root rights on your system. If you use Gnome as your desktop environment, you should also install the Gnome extensions AppIndicator and KStatusNotifierItem. If you use one of the other environments, you’ll also need the gnome-terminal.

Tip

Still using Debian 11? No problem! Follow our instructions on how to install Docker on Debian 11.

Which server for Docker hosting? Dedicated, cloud or VPS?

If you prefer to run a server with Docker and Debian 12 but not to host it yourself, you can rent suitable server hardware from a hosting provider. For instance, IONOS offers a selection of three server models:

These three server options differ significantly in their structure and availability. A dedicated server is exclusively reserved for you and is available 24/7. This type of server is more expensive than the other two and is ideal for individuals and organisations that have high performance and availability needs. Dedicated servers often allow for system modifications and custom configurations.

A VPS (Virtual Private Server) or cloud server is suitable for lower workloads. With a VPS, multiple users share a physical server. While there are fewer computing resources available compared to a dedicated server, system resources are used more efficiently. If one user is not actively using their VPS, other users can access a larger share of the total computing resources. This can become an issue during peak times when many users try to use the server simultaneously.

This problem is partially solved by cloud servers. With a cloud server, it is not the computing resources of a single computer that are shared between several people, but the computing resources of several computers. Individual workloads are therefore executed on several physical servers. For this reason, cloud servers are highly scalable and rarely affected by outages. With many providers, you only pay for the time you actually use your server.

VPS Hosting
Fully virtualised servers with root access
  • Unlimited traffic and up to 1 Gbit/s bandwidth
  • Fast SSD NVMe storage
  • Free Plesk Web Host Edition

Possible deployment scenarios for Docker hosting with IONOS

Finding the right server can often involve time-consuming research. Even if you understand the different server types and what IONOS offers, selecting the right server package can be challenging. To simplify your decision, we’ve compiled three typical use cases along with the most suitable servers from IONOS.

Deployment scenario Server recommendation Alternative server recommendation
Small website and/or database without dynamic content Cloud Server M VPS Linux S
Larger website with dynamic content and multiple databases Cloud Server L VPS Linux M
High-availability enterprise applications with high traffic VPS Linux XXL VPS XL

How to install Docker on Debian 12 step by step

Once you’ve set up the appropriate configuration and Debian 12, you can install Docker. We’ll guide you through the process step by step.

Step 1: Remove old Docker files

If you’ve previously installed Docker on your system, you need to remove those files before reinstalling. If it’s a fresh system where Docker has not been installed yet, you can skip this step. Run the following command to remove the Docker files:

for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt remove $pkg; done
bash

If you don’t want to keep your old Docker images, Docker container or Docker container volumes you should also delete them. To do this, enter the following commands:

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
bash

Step 2: Set up the Docker APT repository

To manage Docker with your package manager, you should use the official apt repository. First, you need to install the required dependencies and add Docker’s GPG key:

sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
bash

Now you can add the repository to your apt sources:

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 > /dev/null
sudo apt update
bash

Step 3: Install Docker

Now you can download and install the Docker packages:

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
bash

Run the hello-world image to ensure that Docker has been successfully installed:

sudo docker run hello-world
bash

If you receive a success message, Docker has been successfully installed on your system!

Step 4: Additional configuration steps

If you don’t receive a success message when running the hello-world image, it may be that Docker is not running on your system. You can check this with the following command:

sudo systemctl status docker
bash

If the Docker service is not running, you can start it and then try running hello-world again.

sudo systemctl start docker
sudo docker run hello-world
bash

By default, Docker is configured to start automatically when the computer boots up. You can disable or re-enable this with the following commands. If you disable it, you will need to start Docker manually with the command mentioned above:

sudo systemctl disable docker
sudo systemctl enable docker
bash
Was this article helpful?
Page top