Debian

How to Install Docker on Debian 12?

How to Install Docker on Debian 12

Docker is one of the most used and renowned platforms that enables users, system developers, and system administrators to create, deploy, run, and then share different applications in a container format.

A container is a small unit of software that contains the code and all of its dependencies for the application. It makes sure that applications that we deploy, run smoothly and with reliability across all computing environments and networks.

In this article, we will see how we can install Docker on Debian 12 which is the latest installment of Debian Linux Distribution. We will see two different ways to install it.

Method 1: Install Docker from Docker Repositories

First of all, we need to update our Debian. Use the following command.

$ sudo apt update

Now we need to install some needed packages and we can do that by the following command.

$ sudo apt install apt-transport-https ca-certificates \curl gnupg-agent software-properties-common

Now we need to install the Docker Repository.

$ sudo apt install lsb-release gnupg2 apt-transport-https ca-certificates curl software-properties-common -y

Now we need to import the GPG Key here.

$ sudo curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg

In this step, we need to add the docker stable repository.

$ sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

Now we are ready to install docker in our Debian.

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

Now we need to ensure that Docker is running and its services are enabled and we can do that with the following command.

$ sudo systemctl start docker && sudo systemctl enable docker

At the end, we need to check the version of docker. It will also ensure if the docker is installed successfully or not.

$ docker version

Here the version is 20.0.4 which also ensures that we have successfully installed docker on our Debian 12.

Method 2: Install Docker Using Binary Packages.

In case if we want to install Docker manually, we can download the .deb file for Docker from its official website and install it. But we will see how we can do that from the terminal.

First of all, we need to download the docker-ce, container-io, and docker-ce-clip files.

$ sudo wget https://download.docker.com/linux/debian/dists/bookworm/pool/stable/amd64/docker-ce_24.0.2-1~debian.12~bookworm_amd64.deb

$ sudo wget https://download.docker.com/linux/debian/dists/bookworm/pool/stable/amd64/docker-ce-cli_24.0.2-1~debian.12~bookworm_amd64.deb

$ sudo wget https://download.docker.com/linux/debian/dists/bookworm/pool/stable/amd64/containerd.io_1.6.21-1_amd64.deb

Now we need to install them. We can do that either by the apt package manager or by the dpkg.

$ sudo apt install ./docker-ce-cli_24.0.2-1~debian.12~bookworm_amd64.deb
$ sudo apt install ./containerd.io_1.6.21-1_amd64.deb

$ sudo apt install ./docker-ce_24.0.2-1~debian.12~bookworm_amd64.deb

We are done with the docker installation and at the end, let’s check the version to confirm whether it is installed or not.

$ docker -version

Now, we need to start the docker service.

$ sudo systemctl enable --now docker

We are done here with the installation of our docker and it is working as well.

Conclusion

Debian 12 came with a huge number of improvements and package updates. This will also ensure that we will be able to install Docker easily as most of the packages for Docker come pre-installed in this Debian release.

In this article, we have discussed and talked about two different ways that can be followed to install docker in Debian 12. One of them is from the official repository and the other one is to install it manually.

Similar Posts