Debian is one of the most popular Linux dis­tri­b­u­tions for server ap­pli­ca­tions 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 pref­er­ences

Docker itself doesn’t require much hardware power, but complex ap­pli­ca­tions can use a sig­nif­i­cant amount of system resources. Before in­stalling, ensure that your system meets the following minimum re­quire­ments:

  • Operating system: Debian 12
  • Processor: 64-bit CPU, min. 2 GHz with KVM support
  • RAM: 4 GB
  • Desktop en­vi­ron­ment: 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 en­vi­ron­ment, you should also install the Gnome ex­ten­sions Ap­pIndi­ca­tor and KSta­tus­No­ti­fierItem. If you use one of the other en­vi­ron­ments, you’ll also need the gnome-terminal.

Tip

Still using Debian 11? No problem! Follow our in­struc­tions 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 sig­nif­i­cant­ly in their structure and avail­abil­i­ty. A dedicated server is ex­clu­sive­ly reserved for you and is available 24/7. This type of server is more expensive than the other two and is ideal for in­di­vid­u­als and or­ga­ni­za­tions that have high per­for­mance and avail­abil­i­ty needs. Dedicated servers often allow for system mod­i­fi­ca­tions and custom con­fig­u­ra­tions.

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 ef­fi­cient­ly. 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 si­mul­ta­ne­ous­ly.

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. In­di­vid­ual 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
VPS hosting at un­beat­able prices on Dell En­ter­prise Servers
  • 1 Gbit/s bandwidth & unlimited traffic
  • Minimum 99.99% uptime & ISO-certified data centers
  • 24/7 premium support with a personal con­sul­tant

Possible de­ploy­ment scenarios for Docker hosting with IONOS

Finding the right server can often involve time-consuming research. Even if you un­der­stand the different server types and what IONOS offers, selecting the right server plan can be chal­leng­ing. To simplify your decision, we’ve compiled three typical use cases along with the most suitable servers from IONOS.

De­ploy­ment scenario Server rec­om­men­da­tion Al­ter­na­tive server rec­om­men­da­tion
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-avail­abil­i­ty en­ter­prise ap­pli­ca­tions with high traffic VPS Linux XXL VPS XL

How to install Docker on Debian 12 step by step

Once you’ve set up the ap­pro­pri­ate con­fig­u­ra­tion 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 pre­vi­ous­ly installed Docker on your system, you need to remove those files before re­in­stalling. 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 repos­i­to­ry

To manage Docker with your package manager, you should use the official apt repos­i­to­ry. First, you need to install the required de­pen­den­cies 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 repos­i­to­ry 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 suc­cess­ful­ly installed:

sudo docker run hello-world
bash

If you receive a success message, Docker has been suc­cess­ful­ly installed on your system!

Step 4: Ad­di­tion­al con­fig­u­ra­tion 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 con­fig­ured to start au­to­mat­i­cal­ly 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
Go to Main Menu