How to Install Docker on Debian

Install Docker Engine on Debian 11, 12, or 13 from the official Docker CE APT repository with deb822 sources, or use Debian docker.io. Includes Compose V2, Buildx, docker group access, hello-world verification, upgrade, and uninstall.

Published

Updated

Read time 8 min read

Reviewed byDeepak Prasad

Install Docker on Debian hero with DEBIAN GUIDE badge, Docker Engine container graphics, and official repository plus Compose V2 feature highlights

Docker Engine runs containers on Linux through a daemon (dockerd), the docker CLI, and containerd. On Debian, most tutorials and vendor deployment notes expect Docker CE from Docker’s official APT repository—not the legacy standalone docker-compose binary and not packages built for Ubuntu URLs.

This guide covers install Docker on Debian for Debian 11 (Bullseye), 12 (Bookworm), and 13 (Trixie): add the official deb822 repository, install docker-ce with Compose V2 and Buildx, optionally use Debian’s docker.io package, run hello-world, add your user to the docker group, upgrade, and remove cleanly. I ran the repository setup and full docker-ce install on Debian 13; docker compose build worked locally. Pulling hello-world from Docker Hub failed on my test host behind an SSL-inspecting proxy—normal networks with outbound Hub access should see the standard success message.

Tested on: Debian 13 (trixie); kernel 6.12.94+deb13-amd64; amd64; Docker CE 29.6.1, Compose 5.2.0, containerd 2.2.5.

IMPORTANT
Use https://download.docker.com/linux/debian with your Debian codename (bookworm, trixie, bullseye). Pointing APT at linux/ubuntu with a Debian suite causes Release file not found errors—a common mistake on Debian 13 threads.

Choose an install method

Method Best for Notes
Official Docker CE repository (deb822) Servers, CI runners, Compose projects, current docs Installs docker-ce, Buildx, Compose V2 plugin
Debian docker.io Quick lab install from main archives only sudo apt install docker.io; older packaging cadence
extrepo docker-ce Hosts that already manage third-party repos with extrepo sudo extrepo enable docker-ce—do not duplicate manual docker.sources

Most readers should use the official Docker CE repository. Pick docker.io only when you deliberately want Debian-maintained packages and do not need Docker Inc’s current plugin set.


Prerequisites

  • Debian 11, 12, or 13 on amd64, arm64, or another architecture Docker publishes for Debian—not i386.
  • sudo and HTTPS access to download.docker.com (or HTTP only in broken-proxy edge cases—not recommended).
  • cURL and ca-certificates for the repository key.
  • Enough disk for images and container layers under /var/lib/docker/.

Check your codename and architecture before adding any repository:

bash
. /etc/os-release && printf '%s (%s)\n' "$PRETTY_NAME" "$VERSION_CODENAME"
dpkg --print-architecture

On the test host:

text
Debian GNU/Linux 13 (trixie) (trixie)
amd64

Refresh APT metadata:

bash
sudo apt update && sudo apt full-upgrade -y

Remove conflicting packages

Debian may already ship docker.io, podman-docker, or older containerd packages. Docker CE replaces them with Docker’s own stack. Remove conflicts before adding the Docker repository (official prerequisite step):

bash
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do
  sudo apt remove -y "$pkg" 2>/dev/null || true
done

Removing packages does not delete existing data under /var/lib/docker/ unless you purge volumes separately.


Method 1: Install Docker CE from the official repository

This mirrors Install Docker Engine on Debian using deb822 sources.

Add Docker’s signing key

bash
sudo apt install -y 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

Inspect the key fingerprint when gpg is available:

bash
gpg --show-keys --with-fingerprint /etc/apt/keyrings/docker.asc

Expected identity:

text
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                      Docker Release (CE deb) <[email protected]>

Create the deb822 source file

The suite must match VERSION_CODENAME from /etc/os-release:

bash
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF

On Debian 13 the file contains Suites: trixie and Architectures: amd64.

Update indexes and confirm docker-ce comes from Docker’s repository:

bash
sudo apt update
apt-cache policy docker-ce

Healthy output on Debian 13:

text
docker-ce:
  Installed: (none)
  Candidate: 5:29.6.1-1~debian.13~trixie
  Version table:
     5:29.6.1-1~debian.13~trixie 500
        500 https://download.docker.com/linux/debian trixie/stable amd64 Packages

Install Engine, CLI, containerd, Buildx, and Compose V2

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

Installed versions on the test host:

text
containerd.io          2.2.5-1~debian.13~trixie
docker-buildx-plugin   0.35.0-1~debian.13~trixie
docker-ce              5:29.6.1-1~debian.13~trixie
docker-ce-cli          5:29.6.1-1~debian.13~trixie
docker-compose-plugin  5.2.0-1~debian.13~trixie

Check the client and service:

bash
docker --version
docker compose version
systemctl status docker.service --no-pager
text
Docker version 29.6.1, build 8900f1d
Docker Compose version v5.2.0
● docker.service - Docker Application Container Engine
     Active: active (running)

Verify with hello-world

bash
sudo docker run --rm hello-world

When Docker Hub is reachable, the tail of the output looks like:

text
Hello from Docker!
This message shows that your installation appears to be working correctly.

On my proxy-filtered test VM, Hub pulls failed with a TLS certificate error. The daemon itself was healthy—docker info reported Server Version: 29.6.1, and a local docker build completed successfully. If you hit the same TLS error, fix corporate CA trust on the host or test from a network without SSL interception before assuming the Engine install failed.

Smoke-test Compose with a local build

This avoids Docker Hub while proving docker compose works:

bash
mkdir -p ~/docker-compose-demo && cd ~/docker-compose-demo
cat > Dockerfile <<'EOF'
FROM scratch
COPY msg /msg
EOF
echo -n 'compose works' > msg
cat > compose.yaml <<'EOF'
services:
  app:
    build: .
    image: compose-local:latest
EOF
sudo docker compose build

Near the end of the build:

text
Image compose-local:latest Built

Remove the demo directory when finished: cd ~ && rm -rf ~/docker-compose-demo.


Method 2: Install Debian docker.io from main archives

When you want Docker from Debian’s own repositories without adding Docker Inc’s source:

bash
sudo apt install -y docker.io

Package availability on Debian 13:

text
docker.io:
  Candidate: 26.1.5+dfsg1-9+b13

docker.io follows Debian’s security and release policy. It does not install the same docker-compose-plugin and docker-buildx-plugin package names from Docker’s repository. Use this path for simple container workflows; use Method 1 when a project’s README says docker compose and current Engine features.

NOTE
Do not install docker.io and docker-ce together—they conflict. Pick one stack per host.

Method 3: Enable Docker CE with extrepo

extrepo can manage the Docker CE source for you:

bash
sudo apt install -y extrepo
sudo extrepo enable docker-ce
sudo apt update
apt-cache policy docker-ce

Use either extrepo or the manual docker.sources file from Method 1—not both. If you switch, remove the other source before sudo apt update:

bash
sudo rm -f /etc/apt/sources.list.d/docker.sources /etc/apt/keyrings/docker.asc
# or, when moving away from extrepo:
sudo extrepo disable docker-ce

Run Docker without sudo

The install creates a docker group. Members can talk to the rootful daemon socket:

bash
sudo usermod -aG docker "$USER"
newgrp docker
docker ps

Log out and back in on graphical sessions so the group change applies everywhere.

WARNING
Users in the docker group can mount host paths and effectively control the system through the daemon. Add only trusted accounts. For stronger isolation, consider Docker rootless mode on developer workstations.

Daily commands worth knowing

Task Command
List running containers docker ps
List all containers docker ps -a
Stop all containers docker stop all containers
View logs docker logs -f
Disk usage docker system df
Prune unused data find and remove unused containers

For container lifecycle patterns, see manage Docker containers with examples.

Optional: log rotation in daemon.json

On busy hosts, cap JSON log growth:

bash
sudo install -m 0755 -d /etc/docker
sudo tee /etc/docker/daemon.json <<'EOF'
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}
EOF
python3 -m json.tool /etc/docker/daemon.json
sudo systemctl restart docker.service

Upgrade Docker CE

Routine upgrades through APT:

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

List available versions before pinning:

bash
apt list --all-versions docker-ce | head

Uninstall Docker CE

Stop the daemon and remove packages (similar workflow on Ubuntu):

bash
sudo systemctl stop docker.service docker.socket 2>/dev/null || true
sudo apt purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
sudo apt autoremove -y

Remove repository configuration:

bash
sudo rm -f /etc/apt/sources.list.d/docker.sources
sudo rm -f /etc/apt/keyrings/docker.asc
sudo apt update
WARNING
sudo rm -rf /var/lib/docker deletes all local images, containers, and volumes. Back up named volumes first.

Confirm removal with list installed packages on Debian:

bash
dpkg-query -W 'docker-ce*' 'containerd.io' 'docker-compose-plugin' 2>/dev/null || echo 'Docker CE packages removed'
command -v docker || echo 'docker command not found'

Troubleshooting

Symptom Likely cause Fix
no installation candidate for docker-ce Wrong suite or Ubuntu URL Use linux/debian and correct VERSION_CODENAME
stable/binary-i386/Packages errors Source requests i386 on unsupported host Set Architectures: to $(dpkg --print-architecture)
permission denied on docker.sock User not in docker group sudo usermod -aG docker $USER then newgrp docker
certificate verify failed pulling images Corporate SSL proxy Install proxy CA system-wide; fix apt/docker TLS trust
Conflicting values for Signed-By Duplicate Docker source files Keep only manual docker.sources or extrepo file
UFW blocks published ports unexpectedly Docker publishes before UFW INPUT rules Bind to 127.0.0.1, use reverse proxy, or Docker-aware firewall rules (Docker firewall docs)
docker compose not found Legacy V1 only Install docker-compose-plugin; use docker compose with a space

Wrong repository URL example

If a guide uses Ubuntu’s path with a Debian codename, APT reports:

text
E: The repository 'https://download.docker.com/linux/ubuntu trixie Release' does not have a Release file.

Remove that source and recreate docker.sources with linux/debian.


References


Summary

For current Docker Engine, Buildx, and Compose V2 on Debian, add Docker’s deb822 source with the correct codename, install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin, and run sudo docker run --rm hello-world. Use docker.io only when you want Debian’s packaged engine without Docker Inc’s repository. Match trixie, bookworm, or bullseye to your release, remove conflicting packages first, and add trusted users to the docker group only when you accept the security trade-off. I installed Docker CE 29.6.1 on Debian 13 from the official repository; verify Hub pulls on your network if a proxy sits between you and registry-1.docker.io.


Frequently Asked Questions

1. What is the difference between docker-ce and docker.io on Debian?

docker-ce comes from Docker official repository and matches current Docker documentation (Engine, Buildx, Compose V2 plugin). docker.io is Debian packaged Docker in main archives—simpler to install but often older and without the same plugin package names.

2. How do I install Docker on Debian 13 Trixie?

Add Docker deb822 source at download.docker.com/linux/debian with Suites set to trixie, run sudo apt update, then sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin. Match the suite to your Debian codename from /etc/os-release.

3. Should I use docker-compose or docker compose on Debian?

Use docker compose (space) with the docker-compose-plugin package—that is Compose V2. The standalone docker-compose command is the legacy V1 tool; new projects should use the plugin.

4. Why does Docker say permission denied on /var/run/docker.sock?

Your user is not in the docker group or you have not logged out after usermod -aG docker $USER. Run newgrp docker for the current shell, or use sudo docker. Remember the docker group grants effective root over the host.

5. Can I install Docker from Debian repositories only?

Yes: sudo apt install docker.io installs Debian packaged Docker without adding Docker Inc repository. For current Engine plus Buildx and Compose V2 from Docker docs, use the official docker-ce repository instead.

6. Why does apt say docker-ce has no installation candidate?

Usually a wrong repository URL (linux/ubuntu with a Debian codename), unsupported architecture, or duplicate Docker source files. Confirm download.docker.com/linux/debian, Suites matches VERSION_CODENAME, and Architectures matches dpkg --print-architecture.

7. How do I update Docker CE on Debian?

Run sudo apt update && sudo apt upgrade, or sudo apt install --only-upgrade docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin to limit the transaction to Docker packages.

8. How do I uninstall Docker CE completely from Debian?

sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin, remove /etc/apt/sources.list.d/docker.sources and /etc/apt/keyrings/docker.asc, then sudo rm -rf /var/lib/docker only when you no longer need images and volumes.
Omer Cakmak

Linux Administrator

Highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on …