Table of Contents
Docker + Debian 12
Docker is a containerization tool that lets you run applications in isolated environments, making deployment and operations significantly easier. Debian 12 is known for stability and security, which makes it an excellent choice for running Docker. In this article, we’ll walk through installing Docker on Debian 12 step by step.
Installing Docker
Before installing Docker, it’s recommended to update your system and make sure all packages are up to date.
sudo apt update && sudo apt upgrade -y
Install required dependencies. Docker needs a few packages to work properly.
sudo apt install -y ca-certificates curl gnupg
Add the official Docker repository
1. Add the GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo tee /etc/apt/keyrings/docker.gpg > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
2. Add the repository to your sources list
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Update package lists and install Docker
sudo apt update
sudo apt install -y docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin
Verify that Docker is installed and running
sudo systemctl enable --now docker
sudo docker --version
Run a test container
sudo docker run hello-world
If the container runs successfully and prints a welcome message, Docker is installed correctly.
Add your user to the Docker group
To run Docker without sudo, add your user to the docker group.
sudo usermod -aG docker $USER
newgrp docker
After joining the group, you won’t need to log out and back in for changes to take effect. You can now verify Docker by running any Docker command.
Conclusion
Docker is now installed on Debian 12, and you can use containers to deploy your applications.