Title: How to Install Docker on Debian 12 (Step-by-Step Guide)
Published: May 9, 2025
Author: Ariffud Muhammad
Docker is a powerful containerization platform that allows developers to build, test, and run applications in isolated environments. This means you can experiment freely without risking your system’s stability. When paired with Debian—a Linux distribution known for its reliability—it becomes an excellent setup for both development and production environments.
In this guide, we’ll show you how to install Docker on Debian 12 (also compatible with Debian 11), covering everything from setting up repositories to verifying your installation.
🛠️ Prerequisites
Before you begin, ensure the following:
– Your system is running Debian 11 (Bullseye) or Debian 12 (Bookworm). To check your version, run:
lsb_release -a
– You have root or sudo privileges.
– If using a VPS, confirm SSH access and root permissions. Hostinger’s VPS plans come with full root access and a built-in browser terminal for easy command-line access.
🔧 Step 1: Update Your System
Start by updating your package list and upgrading installed packages:
sudo apt update && sudo apt upgrade -y
This ensures compatibility and security for the upcoming Docker installation.
📦 Step 2: Install Required Dependencies
Install essential tools:
sudo apt install ca-certificates curl
Then, create a keyring directory for Docker’s GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
🔐 Step 3: Add Docker’s GPG Key
Download and store Docker’s official GPG key:
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
Set the correct permissions:
sudo chmod a+r /etc/apt/keyrings/docker.asc
📁 Step 4: Add the Docker Repository
Add Docker’s official repository to your system:
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 > /dev/null
📥 Step 5: Install Docker and Its Components
Update your package index:
sudo apt update
Then install Docker and its related tools:
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
To install a specific version, first list available versions:
apt-cache madison docker-ce | awk ‘{ print $3 }’
Set your desired version string and use it in the install command:
VERSION_STRING=5:28.1.0-1~debian.12~bookworm
sudo apt install docker-ce=$VERSIONSTRING docker-ce-cli=$VERSIONSTRING containerd.io docker-buildx-plugin docker-compose-plugin
▶️ Step 6: Start and Enable Docker
Start the Docker service:
sudo systemctl start docker
Enable it to start on boot:
sudo systemctl enable docker
Check its status:
sudo systemctl status docker
You should see “active (running)” if everything is working correctly.
✅ Step 7: Verify the Installation
Check Docker and Docker Compose versions:
docker –version
docker compose version
To test Docker, run the Hello World container:
sudo docker run hello-world
You should see a success message confirming that Docker is installed and functioning.
🎉 That’s it! Docker is now successfully installed on your Debian system.
🧾 Summary
Here’s a quick recap of the steps:
1. Update your system.
2. Install required dependencies.
3. Add Docker’s GPG key.
4. Set up the Docker repository.
5. Install Docker and its components.
6. Start and enable the Docker service.
7. Verify the installation.
With Docker up and running, you’re ready to start building and deploying containerized applications. To get started, check out our Docker Cheat Sheet for essential commands.
📚 Frequently Asked Questions
Which Debian versions support Docker?
Docker officially supports Debian 11 and 12. Older versions like Debian 10 may still work but aren’t recommended.
Can I install Docker with a single command?
Yes, using the convenience script:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
However, this is not advised for production environments due to reduced control over the process.
How do I update Docker later?
Run:
sudo apt update && sudo apt upgrade -y
How can I uninstall Docker?
Remove Docker packages:
sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-ex
Discover more from WIREDGORILLA
Subscribe to get the latest posts sent to your email.