Do you want to know how to install Docker on Debian 12? You are at the right place!
Docker is a platform used for developing and running applications inside lightweight and portable containers. Its advantage includes a consistent environment across different systems. In addition, it also allows different applications to run on various systems without worrying about setup issues.
This guide will cover two methods of installing Docker on Debian 12. These include using the Command Line (CLI) and the Graphical User Interface (GUI).
So, let’s begin!
How to Install Docker on Debian 12
Let’s explore each of the mentioned methods one by one.
Method 1: Installing Docker Using Command Line Interface
Firstly, update the Debian 12 repository to confirm all the packages are up to date:
sudo apt update

Now, install the Docker’s dependencies to proceed with Docker installation:
sudo apt install ca-certificates curl gnupg lsb-release -y

This command makes sure you have the necessary certificates, data transfer tools, encryption utilities, and distribution information needed for Docker’s installation and configuration.
Now, create a new directory using the listed command:
sudo mkdir -p /etc/apt/keyrings
After that, add Docker’s GPG key to your system with the following command:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Next, insert the Docker repository into your Debian system so that it can retrieve and verify the Docker packages from the official Docker repository:
echo “deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update the system repository to save all the changes made:
sudo apt update

Now start and enable Docker by using:
sudo systemctl start docker
sudo systemctl enable docker

For verification, check Docker’s version:
sudo docker --version

Additionally, you can write the default “Hello World” program to make sure that Docker has been successfully installed.
Method 2: Installing Docker Using GUI
If you want to make the installation process easier, try installing Docker using the Docker Desktop deb file. It also provides additional features for easier configuration and monitoring than command-line installations.
To do so, first, install the Docker deb file, as indicated below:

Now, use apt to install Docker Desktop from the deb file:
sudo apt install ./docker-desktop-4.28.0-amd64.deb

Lastly, for verification, search “Docker” in the search menu:

This signifies that Docker has been installed successfully on your Debian 12 machine.
Conclusion
In this guide, we demonstrated how to install Docker on Debian 12 using CLI and GUI. We first updated repositories and installed dependencies through the CLI, then added Docker’s GPG key and repository, and started Docker.
Alternatively, we installed Docker using the Docker Desktop .deb file, which offers a user-friendly interface and additional features for easier configuration and monitoring.