Docker on Debian is about as straightforward as container installs get, but the official Docker repo is the only way to get a current version. The packages in Debian’s default repositories lag behind significantly, and you miss out on Docker Compose as a built-in plugin. With Docker’s own repo, Compose ships as docker compose (no hyphen, no separate binary), which simplifies things.
This guide walks through a clean Docker CE install on both Debian 13 (trixie) and Debian 12 (bookworm) using Docker’s official APT repository. Once Docker is running, you can spin up multi-container stacks like Kafka with Docker Compose in minutes.
Tested April 2026 on Debian 13 (trixie) and Debian 12 (bookworm) with Docker CE 29.4.0, Docker Compose v5.1.1
Prerequisites
Before starting, confirm you have:
- Debian 13 (trixie) or Debian 12 (bookworm), 64-bit
- Root or a user with
sudoprivileges - Internet connectivity to reach Docker’s APT repository
Remove Old Docker Packages
Debian ships older or conflicting packages like docker.io and podman-docker. Remove them first to avoid conflicts with Docker CE:
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
If none of these are installed, apt-get remove will simply skip them. No harm done.
Install Prerequisites
Update the package index and install the packages needed to add Docker’s repository over HTTPS:
sudo apt-get update
sudo apt-get install ca-certificates curl
Both packages are likely already present, but it costs nothing to confirm.
Add Docker’s GPG Key
Docker signs its packages with a GPG key. Download it and store it in the /etc/apt/keyrings/ directory:
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
This ensures APT can verify the authenticity of Docker packages before installing them.
Add the Docker APT Repository
The following command auto-detects your Debian codename and adds the correct repository:
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
On Debian 13 this resolves to trixie, and on Debian 12 to bookworm. Refresh the package index after adding the repo:
sudo apt-get update
You should see Docker’s repository listed in the output, confirming it was added correctly.
Install Docker CE
Install Docker Engine along with the CLI tools, containerd, and the Compose and Buildx plugins:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
This pulls in everything you need. Docker Compose is included as a plugin, so there is no separate docker-compose binary to install.
Verify the Installation
Check the installed Docker version:
docker --version
The output confirms Docker CE 29.4.0:
Docker version 29.4.0, build 9d7ad9f
Verify Docker Compose is available as a plugin:
docker compose version
Expected output:
Docker Compose version v5.1.1
For a more detailed view of the Docker daemon, run docker info:
docker info
Key details from the output on Debian 13:
Server Version: 29.4.0
Storage Driver: overlayfs
Cgroup Driver: systemd
Cgroup Version: 2
Kernel Version: 6.12.57+deb13-amd64
Operating System: Debian GNU/Linux 13 (trixie)
Run the Hello World Container
The classic smoke test. Pull and run the hello-world image:
sudo docker run hello-world
A successful run prints this message:
Hello from Docker!
This message shows that your installation appears to be working correctly.
If you see that, Docker is pulling images and running containers without issues.
Run Docker as a Non-Root User
By default, Docker commands require sudo. To run Docker as your regular user, add yourself to the docker group:
sudo usermod -aG docker $USER
Activate the new group membership without logging out:
newgrp docker
Now test without sudo:
docker run hello-world
If it runs successfully, you’re set. For the change to persist across sessions, log out and back in (or reboot).
Test Docker Compose with Nginx and Redis
A quick multi-container test proves that Docker Compose works end to end. Create a project directory:
mkdir ~/compose-test && cd ~/compose-test
Create a docker-compose.yml file with Nginx and Redis:
cat > docker-compose.yml << 'YAML'
services:
web:
image: nginx:latest
ports:
- "8080:80"
depends_on:
- cache
cache:
image: redis:latest
ports:
- "6379:6379"
YAML
Start both containers in detached mode:
docker compose up -d
Check that both services are running:
docker compose ps
Both containers should show a status of "Up":
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
compose-test-cache-1 redis:latest "docker-entrypoint.s…" cache 10 seconds ago Up 9 seconds 0.0.0.0:6379->6379/tcp
compose-test-web-1 nginx:latest "/docker-entrypoint.…" web 10 seconds ago Up 9 seconds 0.0.0.0:8080->80/tcp
Hit the Nginx welcome page to confirm it responds:
curl -s http://localhost:8080 | head -5
You should see the Nginx default HTML page. Clean up when done:
docker compose down
This stops and removes both containers and the default network.
Differences Between Debian 13 and Debian 12
The Docker installation process is identical on both releases. The only real difference is the codename used in the APT repository URL, which the install command detects automatically. Here is a quick comparison:
| Item | Debian 13 (trixie) | Debian 12 (bookworm) |
|---|---|---|
| Codename | trixie | bookworm |
| Default kernel | 6.12 | 6.1 |
| Docker packages | Same (docker-ce, containerd.io, etc.) | Same |
| Docker version available | 29.4.0 | 29.4.0 |
| Compose version | v5.1.1 | v5.1.1 |
| Cgroup version | v2 | v2 |
Both releases use cgroups v2 and systemd as the cgroup driver. Docker commands, configurations, and Compose files work the same way on either version. If you're running Debian 12 and planning to upgrade to 13, your Docker setup will carry over without changes.
Uninstall Docker CE
If you ever need to remove Docker completely, purge the packages:
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
This removes the packages but leaves images, containers, and volumes on disk. To wipe those as well:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
After this, Docker is fully removed from the system.
Troubleshooting
Error: "Cannot connect to the Docker daemon"
This usually means the Docker service is not running. Start and enable it:
sudo systemctl enable --now docker
Verify the service status:
sudo systemctl status docker
It should show active (running). If the service fails to start, check the journal for details with journalctl -xeu docker.
Error: "permission denied while trying to connect to the Docker daemon socket"
You're running Docker commands without sudo and your user is not in the docker group. Add yourself to the group as shown in the non-root section above, then log out and back in. Running groups should list docker in the output.
APT errors after adding the Docker repository
If apt-get update reports GPG or signature errors, verify that the GPG key was downloaded correctly. Re-run the key download commands and check that /etc/apt/keyrings/docker.asc exists and is readable. On Debian 13 specifically, make sure the trixie codename is available in Docker's repository (it was added in early 2025).