Docker installation on Debian 12

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

This article shows an installation of Docker on a Debian 12 server.

Installation

All that is required is an already installed Debian 12 system (VM or hardware server) and root access to the system. You can then install Docker with the following commands:

# Install packages required for the installation

sudo su &&
apt update &&
apt install ca-certificates curl gnupg apt-transport-https gpg

# Download GPG key and store repository in the system

curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" |tee /etc/apt/sources.list.d/docker.list > /dev/null 
apt update 

# Install Docker packages

apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose

Verification

You can check whether the installation was successful and docker also starts at system startup with the following command:

root@js-checkmk-01:~# systemctl is-active docker
active

If there are still difficulties, this usually helps:

sudo rm /var/lib/docker/containers/ -rf && sudo reboot

Attention! This deletes all containers, if any have already been created!

A functional test can also be carried out by starting the docker image hello-world with docker run hello-world.

root@js-checkmk-02:/home/tk# docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
719385e32844: Pull complete
Digest: sha256:dcba6daec718f547568c562956fa47e1b03673dd010fe6ee58ca806767031d1c
Status: Downloaded newer image for hello-world:latest

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

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
Foto Jonas Sterr.jpg

Author: Jonas Sterr

Jonas Sterr has been working for Thomas-Krenn for several years. Originally employed as a trainee in technical support and then in hosting (formerly Filoo), Mr. Sterr now mainly deals with the topics of storage (SDS / Huawei / Netapp), virtualization (VMware, Proxmox, HyperV) and network (switches, firewalls) in product management at Thomas-Krenn.AG in Freyung.


Related articles

Hard Disk Formatting/Partitioning and Mounting in Debian Linux
Network Configuration under Debian
Perl warning Setting locale failed in Debian