# 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](https://www.ionos.com/digitalguide/server/know-how/what-is-an-operating-system/): [Debian](https://www.ionos.com/digitalguide/server/know-how/debian-the-universal-system-software/) 12
- Processor: 64-bit CPU, min. 2 GHz with **[KVM](https://www.ionos.com/digitalguide/server/know-how/what-is-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](https://www.ionos.com/digitalguide/server/configuration/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:

- [Dedicated Server](https://www.ionos.com/servers/dedicated-servers "Dedicated Server from IONOS")
- [Cloud Server](https://www.ionos.com/cloud/cloud-servers "Cloud Server from IONOS")
- [VPS (virtual private server)](https://www.ionos.com/servers/vps "Dedicated Server from IONOS")

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 organizations 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.

## 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 plan can be challenging. To simplify your decision, we’ve compiled three typical use cases along with the most suitable servers from IONOS.

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

## 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:

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

If you don’t want to keep your old [Docker images](https://www.ionos.com/digitalguide/server/know-how/docker-images/), [Docker container](https://www.ionos.com/digitalguide/server/know-how/docker-container/) or [Docker container volumes](https://www.ionos.com/digitalguide/server/know-how/docker-container-volumes/) you should also delete them. To do this, enter the following commands:

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

### 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:

```bash
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
```

Now you can add the repository to your `apt` sources:

```bash
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
```

### Step 3: Install Docker

Now you can download and install the Docker packages:

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

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

```bash
sudo docker run hello-world
```

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

Tip To install Docker on a different operating system, you can take a look at our additional articles:

- [Install Docker on Ubuntu 22.04](https://www.ionos.com/digitalguide/server/configuration/install-docker-on-ubuntu-2204/)
- [Install Docker on Ubuntu 20.04](https://www.ionos.com/digitalguide/server/configuration/install-docker-on-ubuntu-2004/)
- [Install Docker on RHEL 8](https://www.ionos.com/digitalguide/server/configuration/install-docker-on-rhel-8/)
- [Install Docker on RHEL 9](https://www.ionos.com/digitalguide/server/configuration/docker-on-rhel-9/)
- [Install Docker on CentOS 7](https://www.ionos.com/digitalguide/server/configuration/install-docker-on-centos-7/)
- [Docker on Windows 10](https://www.ionos.com/digitalguide/server/configuration/docker-on-windows-10/)
- [Docker on Windows 11](https://www.ionos.com/digitalguide/server/configuration/docker-windows-11/)

### 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:

```bash
sudo systemctl status docker
```

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

```bash
sudo systemctl start docker
sudo docker run hello-world
```

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:

```bash
sudo systemctl disable docker
sudo systemctl enable docker
```


This is a markdown version of: [https://www.ionos.com/digitalguide/server/configuration/install-docker-on-debian-12/](https://www.ionos.com/digitalguide/server/configuration/install-docker-on-debian-12/) for AI/LLM consumption.