Install Docker Engine and Compose on Debian 12 and Debian 13
A reviewable Docker installation for Debian hosts, with the firewall and privilege implications left under the administrator's control.
Before you start
Use a supported Debian 12 or 13 host. This guide installs the official Docker packages and does not change user groups.
- Run commands with sudo.
- Do not run the installer on a host with Docker or containerd already installed.
- Published Docker ports can bypass some firewall tools; review Docker's DOCKER-USER guidance before exposing services.
Use the versioned installer
The installer validates Debian, architecture and existing packages, then configures Docker's official APT repository. It stops safely if it finds a conflicting installation.
curl -fsSL https://scripts.lrq.lat/docker/v1.0.0/install.sh | sudo bashDownloads the immutable installer and installs Docker Engine, Buildx and Compose plugin.
curl -fsSL https://scripts.lrq.lat/docker/v1.0.0/install.sh | sudo bash -s -- statusShows Docker service health and installed Docker and Compose versions without changing the host.
Install manually
This path follows Docker's official APT repository instructions and is preferable when every system change must be reviewed.
sudo apt update
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.ascInstalls prerequisites and stores Docker's signing key in a dedicated APT keyring.
sudo tee /etc/apt/sources.list.d/docker.sources >/dev/null <<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
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginAdds the official stable repository for the current Debian codename, then installs Engine, CLI, containerd, Buildx and Compose.
Validate, update and reverse
Use sudo by default. Membership in the docker group provides root-equivalent access and is intentionally not configured here.
sudo systemctl status docker --no-pager
sudo docker run hello-world
sudo docker compose versionChecks the service, runs Docker's test image and confirms the modern Compose plugin.
sudo apt update
sudo apt upgradeUpdates Docker through the official APT repository with the rest of the host packages.
sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo rm /etc/apt/sources.list.d/docker.sources /etc/apt/keyrings/docker.ascRemoves Docker packages and repository configuration. Images, containers, volumes and /var/lib/docker are deliberately not deleted.