Tutorial Install Docker on Linux Debian 12

Install Prerequisites

$ sudo apt update

$ sudo apt install apt-transport-https ca-certificates curl gnupg


Add Docker’s GPG Repo Key

$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg


Add the Docker Repo to Debian 12

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

Next, refresh the package list.

$ sudo apt update


Install Docker on Debian 12 (Bookworm)

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

This installs the following Docker components:

docker-ce: The Docker engine itself.

docker-ce-cli: A command line tool that lets you talk to the Docker daemon.

containerd.io: A container runtime that manages the container’s lifecycle.

docker-buildx-plugin: A CLI plugin that extends the Docker build with many new features.

That’s all! Docker should now be installed; the service should start and be enabled to start automatically on boot.

In addition, you can check the Docker service status using the following:

$ sudo systemctl is-active docker


Enabling Non-root Users to Run Docker Commands

$ docker ps

So, to run Docker commands as a non-root user, you must add your user to the “docker” group. To do that, type in the following:

$ sudo usermod -aG docker ${USER}


Restart Docker Service

$ sudo systemctl restart docker

$ docker container ls -a

or

$ docker images


Source :

https://linuxiac.com/how-to-install-docker-on-debian-12-bookworm/

Comments