Home Ā» How to Install Docker on Debian 12
Posted in

How to Install Docker on Debian 12

What is Docker?

Docker is an open-source platform that enables developers and system administrators to build, ship, and run applications inside lightweight, portable containers. Containers package an application and all its dependencies together, ensuring consistent behavior across different environments. This makes Docker ideal for simplifying software deployment, scaling, and management on any system — from a developer’s laptop to cloud servers.

This guide will show you how to install Docker Engine on Debian 12 (Bookworm) step by step.

Important Note:
This guide assumes you are running all commands as the root user, so you won’t need to prefix commands with sudo.

If you are installing Docker as a regular user, remember to add sudo before commands that require administrative privileges. For example:

sudo apt update
sudo apt install docker-ce

Also, to run Docker commands without sudo, make sure to add your user to the Docker group at the end of the installation:

sudo usermod -aG docker $USER
newgrp docker

This will allow you to run Docker commands without needing root privileges.

Prerequisites

  • Debian 12 system (root or sudo access required)
  • Internet connection

Step 1: Update Your System

root@frhb95653flex:~# apt update && sudo apt upgrade -y

Step 2: Install Required Packages

Install packages that allow apt to use a repository over HTTPS:

root@frhb95653flex:~# apt install ca-certificates curl gnupg lsb-release -y

Step 3: Add Docker’s Official GPG Key

root@frhb95653flex:~# mkdir -p /etc/apt/keyrings
root@frhb95653flex:~# curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Step 4: Set Up the Docker Repository

root@frhb95653flex:~# echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 5: Update Package Index

root@frhb95653flex:~# apt update

Step 6: Install Docker Engine

root@frhb95653flex:~# apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Step 7: Verify Docker Installation

Check if Docker is running:

root@frhb95653flex:~# systemctl status docker
ā— docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; preset: enabled)
     Active: active (running) since Tue 2025-05-20 23:59:11 UTC; 1min 38s ago
TriggeredBy: ā— docker.socket
       Docs: https://docs.docker.com
   Main PID: 108997 (dockerd)
      Tasks: 7
     Memory: 25.6M
        CPU: 141ms
     CGroup: /system.slice/docker.service
             └─108997 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Run a test container:

root@frhb95653flex:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
e6590344b1a5: Pull complete 
Digest: sha256:dd01f97f252193ae3210da231b1dca0cffab4aadb3566692d6730bf93f123a48
Status: Downloaded newer image for hello-world:latest

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

Done!

Docker is now installed and ready to use on your Debian 12 system.

Sources: Official Docker Documentation – Debian Installation

Docker Category: Here

Leave a Reply

Your email address will not be published. Required fields are marked *