In this tutorial, we will show you how to install Docker on Debian 11. For those of you who didn’t know, Docker is an open-source project that supports building, testing, deploying, and managing applications in self-sufficient, portable containers. It provides an efficient way to package applications with their libraries and other dependencies into a standardized unit for software development. Docker containers are much faster and more efficient than a virtual machine because they don’t have to run an entire operating system, just the executable that serves the application.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Docker Comunity Edition (CE) on a Debian 11 (Bullseye).
- A server running one of the following operating systems: Debian 11 (Bullseye).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Docker on Debian 11 Bullseye
Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following
apt commands in the terminal:
sudo apt update sudo apt upgrade sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
Step 2. Installing Docker on Debian 11.
Now we add the official Docker CE repository to your system:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
Once added Docker CE repository, run the following commands to install it:
sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io
Verify the installation of the Docker version using the following command:
After is completed, start the Docker service on your Debian Linux and also enable it to run automatically with system boot:
sudo systemctl start docker sudo systemctl enable docker
To test the Docker installation, we will run the
sudo docker run hello-world
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b8g0detz29403: Pull complete Digest: sha256:0fe98d7gotof1f85b7c1e8cc81fmoon8d623fcb225gaskeunbec85b38 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/
Congratulations! You have successfully installed Docker. Thanks for using this tutorial for installing the latest version of Docker CE on Debian 11 Bullseye. For additional help or useful information, we recommend you check the official Docker website.