Announcement

Collapse
No announcement yet.

How To: Install Docker on Debian 12 (Bookworm)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How To: Install Docker on Debian 12 (Bookworm)

    How To: Install Docker on Debian 12 (Bookworm)

    This guide walks you through installing Docker Engine on Debian 12 using Docker’s official APT repository.

    Prerequisites
    - A server running Debian 12
    - Root privileges or a user with sudo access

    ---

    Step 1: Update the System and Install Dependencies
    Update the package index and install the tools needed to use Docker’s secure repository:

    Code:
    sudo apt update
    sudo apt upgrade -y
    sudo apt install ca-certificates curl -y
    Step 2: Add Docker’s Official GPG Key
    Add Docker’s official signing key:

    Code:
    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: Set Up the Docker Repository
    Add Docker’s official stable repository to your APT sources:

    Code:
    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 4: Install Docker Engine and Compose
    Update the package index, then install Docker Engine and the Docker Compose plugin:

    Code:
    sudo apt update
    sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
    Step 5: Verify the Installation
    Check that the Docker service is running:

    Code:
    sudo systemctl status docker
    Press `q` to exit the status view.

    You can also test the installation by running the standard Hello World container:

    Code:
    sudo docker run hello-world
    ---

    Pro Tip: Run Docker Without Sudo (Optional)
    By default, Docker commands require root privileges. To run Docker as your regular user, add the user to the docker group:

    Code:
    sudo usermod -aG docker $USER
    Log out and back in for the new group membership to take effect.

    Security note: Membership of the docker group grants root-level privileges. Only add trusted users.
Working...
X