Skip to content
Blog

Installing Docker Engine on Debian 12 (Bookworm): Step-by-Step Guide

Setting up official Docker apt repository, GPG keys, installing docker-ce, containerd.io, Buildx, Compose plugin, systemd enablement, and non-root user setup.

Published on • October 24, 2026

AI Assistant

Debian 12 (Bookworm) is a preferred Linux distribution for production cloud servers due to its rock-solid stability and low memory overhead. Installing the official Docker Engine (docker-ce) from Docker’s official APT repositories ensures you get the latest security patches, Buildx performance, and Docker Compose v2 plugin updates.

In this step-by-step walkthrough, we cover setting up Docker Engine on Debian 12.

Step 1: Uninstall Conflict Packages

Debian official repositories contain unofficial packages (docker.io, docker-doc, podman-docker) that conflict with official Docker Engine binaries. Remove them first:

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

Step 2: Set Up Official Docker APT Repository

Install required security certificates and download Docker’s official GPG key:

# Add Docker's official GPG key
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] 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-get update

Step 3: Install Docker Engine & Plugins

Install Docker Community Edition, Buildx, and Compose plugins:

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

Step 4: Manage Systemd Service & Non-Root Access

Verify Docker is running and enable auto-start on boot:

sudo systemctl enable --now docker
sudo systemctl status docker

By default, executing docker requires sudo. Add your user account to the docker group:

# Add current user to docker group
sudo usermod -aG docker $USER

# Apply group permissions to current session
newgrp docker

Step 5: Test Docker Installation

Run the official hello-world test container:

docker run --rm hello-world

If successful, Docker downloads the image and prints "Hello from Docker!".

Summary

You now have production-ready Docker Engine running on Debian 12 with full Buildx and Docker Compose support.

References & Further Reading