When you’re setting up Debian to run applications in containers, the package source needs to match your Debian release. Docker Engine is the service that builds and runs containers on a Linux system.
This article walks through installing Docker Engine from Docker’s Debian repository and checking it with hello-world.
TL;DR: Install Docker Engine from Docker’s Debian repository
Use Docker’s official APT source on Debian 12 or 13, then run hello-world to check container execution.
- Confirm the release codename with . /etc/os-release && echo “$VERSION_CODENAME”.
- Add Docker’s signing key and deb822 source file.
- Install the packages and verify with sudo docker run hello-world.
What is Docker Engine on Debian?
Docker Engine is the service that builds and runs containers on a Linux host. The Docker CLI sends requests to its daemon, while containerd handles container lifecycle work underneath.
A container is an isolated process with its application files and dependencies. An image is its read-only template. Engine runs containers, and Docker Hub is a registry from which images can be downloaded.
Docker’s Debian repository supplies Engine, Compose and Buildx packages. Compose manages services in a project file, while Buildx extends image building. Debian’s docker.io is a separate package set, so do not mix it with Docker CE.
| Package | Role |
|---|---|
| docker-ce | Docker Engine service |
| docker-ce-cli | Command-line client |
| containerd.io | Container runtime dependency |
| docker-buildx-plugin | Buildx command |
| docker-compose-plugin | Compose V2 command |
How to install Docker on Debian step by step
Docker supports Debian 12 Bookworm and Debian 13 Trixie, with packages for amd64 and arm64. APT uses the release codename as the repository suite, so the source must match the installed release. A wrong suite or unsupported architecture prevents APT from finding the intended package index.
You need sudo access and a connection to Docker’s package host. APT’s package index catalogs available names and versions, and must be refreshed after adding a source.
Older Docker packages and runtimes can conflict with Docker CE. Check Docker’s official list before choosing which packages to remove.
Step 1: Update APT and install repository tools
Refresh APT and install the certificate and download tools needed for Docker’s signing key. APT uses that key to verify repository metadata.
sudo apt update
sudo apt install ca-certificates curl
Step 2: Add Docker’s signing key
Save Docker’s key in APT’s keyring directory. Set read access for APT because the source entry will reference this key specifically for Docker’s repository.
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
Step 3: Add the Debian APT source
Create a deb822 source file for Docker’s Debian repository. It names the stable component, system architecture and signing key.
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
sudo apt update
The codename resolves to bookworm on Debian 12 or trixie on Debian 13. For a derivative, identify its Debian base first. A wrong suite can cause a missing Release file or no Docker CE candidate.
Step 4: Install Engine and verify it
Install the Docker package set in one APT transaction using the command below. APT selects versions from the stable source for your Debian release.
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Docker recommends hello-world as an end-to-end check. The daemon pulls the image if needed, runs its short-lived container and prints a confirmation. The pull needs Docker Hub access.
sudo docker run hello-world
Common Docker installation errors on Debian
APT errors occur during package setup. Daemon errors mean the CLI cannot communicate with Docker’s service.
| Message or situation | Check |
|---|---|
| docker-ce has no installation candidate | Confirm the Docker Debian URL, suite codename and architecture in docker.sources, then run sudo apt update. |
| Repository has no Release file | Make sure the suite matches the installed Debian release, such as bookworm or trixie. |
| Cannot connect to Docker daemon | Check the service with sudo systemctl status docker, then start it with sudo systemctl start docker if it is stopped. |
| Permission denied on the Docker socket | Use sudo, or deliberately configure non-root access after reading Docker’s security warning. |
Docker supports iptables-nft and iptables-legacy, but not firewall rules created directly with nft. Review Docker’s firewall guidance before exposing container ports.
The docker group removes the need for sudo, but Docker warns that its members gain root-level privileges through the daemon. Grant membership only to trusted administrators. Otherwise, keep using sudo.
- Docker’s instructions cover Debian 12 Bookworm and Debian 13 Trixie.
- Choose Docker CE or Debian’s docker.io package, not both.
- Use docker compose with the Compose plugin package.
Conclusion: Keep the Debian codename matched
The APT source ties the Debian release and architecture to Docker’s signing key. Match it to your system, install Engine and check execution with hello-world.
These related resources cover the next useful Linux tasks:
- Install Docker on Raspberry Pi OS.
- Compare Docker and Podman.
- Use curl on Linux.
- Remove packages with APT.
- Manage Linux services.
- See Docker’s Debian installation documentation for supported releases and commands.
Does Docker support Debian 12 and Debian 13?
Yes. Docker’s Debian installation instructions list Debian 12 Bookworm and Debian 13 Trixie. Match the APT source suite to your installed release.
Should I install docker.io or docker-ce?
Choose one package source. docker-ce comes from Docker’s official repository, while docker.io is Debian’s package and conflicts with the Docker CE package set.
How do I check whether Docker works after installation?
Run sudo docker run hello-world. Docker downloads the image if it is not local, starts a short-lived container and prints a confirmation. The pull needs access to Docker Hub.
Can I run Docker without sudo?
Yes, Docker documents adding trusted users to the docker group, but warns that group members can gain root-level control through the daemon. Use sudo unless you accept that privilege.
