Docker Installation unter Debian 12

Aus Thomas-Krenn-Wiki
Zur Navigation springen Zur Suche springen

Dieser Artikel zeigt eine Installation von Docker auf einem Debian 12 Server.

Installation

Vorausgesetzt wird nur ein bereits installiertes Debian 12 System (VM oder Hardware-Server) und Root-Zugriff auf das System. Danach kann man mit folgenden Befehlen Docker installieren:

# Pakete die zur Installation benötigt werden installieren

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

# GPG-Key downloaden und Repository hinterlegen im 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 

# Docker-Pakete installieren

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

Verifikation

Ob die Installation erfolgreich war und docker auch beim Systemstart startet kann man mit folgendem Befehl überprüfen:

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

Sollte es noch Schwierigkeiten geben, hilft in der Regel:

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

Achtung! Das löscht alle Container, falls schon welche erstellt wurden!

Außerdem kann ein Funktionstest gemacht werden, indem das docker-Image hello-world mit docker run hello-world gestartet wird:

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

Autor: Jonas Sterr

Ich beschäftige mich mit den Themen Software Defined Storage, Proxmox Virtualisierung auf Basis von KVM, QEMU & Ceph im Produktmanagement der Thomas-Krenn.AG in Freyung. Proxmox ist meine absolute Leidenschaft und ich freue mich gerne über Kontaktanfragen und einen Austausch auf LinkedIn.


Das könnte Sie auch interessieren

Checkmk RAW Edition - Docker Container Installation
InfluxDB2 + Grafana Konfiguration eines Metric-Servers für Proxmox VE
Root Data Directory in Docker dauerhaft ändern