DebianLinuxTutorials

How To Install Docker on Debian 11

Install Docker on Debian 11

In this tutorial, we will show you how to install Docker on Debian 11. For those of you who didn’t know, Docker has revolutionized the way software is developed, packaged, and deployed in modern environments. As a powerful containerization platform, Docker enables developers to create, ship, and run applications efficiently across different systems. Debian 11, also known as “Bullseye,” is a stable and reliable Linux distribution that serves as an excellent foundation for running Docker containers.

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 the step-by-step installation of the Docker Community Edition (CE) on a Debian 11 (Bullseye).

Prerequisites

  • A server running one of the following operating systems: Debian 11.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or 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. To begin the installation process, we first need to update the package list on our Debian 11 system. This ensures that we have access to the latest package information and security updates. Open your terminal and run the following command:

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.

To install Docker on Debian 11, you need to add Docker’s official GPG key and repository to your system. This key ensures the authenticity of the Docker packages you will be installing. Execute the following commands in your terminal:

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

With the repository set up, you can now install Docker Engine using the apt repository. To do this, run the following command:

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

Verify the installation of the Docker version using the following command:

docker -v

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 hello-world container:

sudo docker run hello-world

This command downloads a small Docker image called “hello-world” and runs it as a container. If the installation is successful, you should see a message that says “Hello from Docker!” along with some additional information about the Docker installation.

If Docker is installed correctly, you should see the message “Hello from Docker!” printed on the terminal.

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.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button