How to Install Docker CE on Debian 11

Updated on January 12, 2022
How to Install Docker CE on Debian 11 header image

Introduction

Docker CE (Community Edition) is a free and open-source tool with a container runtime environment for application containerization. Containerization works by creating and running software applications within an isolated environment, together with the dependencies and libraries used by the applications. The final product of this process is a container. Docker uses OS-level virtualization for building, deploying, running, and managing containers. The advantages of the functionality offered are scalability, cost-effectiveness, efficiency, productivity, and lightweight applications.

In this article, you will install Docker CE on Debian 11 server.

Prerequisites

Perform the following steps first:

1. Install the Required Dependencies

Install the dependencies required for Docker to run.

$ sudo apt install apt-transport-https lsb-release ca-certificates curl gnupg -y

2. Install the Docker Repository

Download and add the Docker GPG key.

$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add the downloaded repository.

$ echo "deb [arch=$(dpkg --print-architecture) 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 > /dev/null

Update the system.

$ sudo apt update

3. Install the Docker Engine

Install Docker engine.

$ sudo apt -y install docker-ce docker-ce-cli containerd.io

Verify the Docker installation and version.

$ sudo docker version

Enable the Docker service to start up on system boot.

$ sudo systemctl enable docker

Check the Docker service status.

$ sudo systemctl status docker

4. Test the Docker Installation

To get started, run the getting-started docker container.

$ sudo docker run -d -p 80:80 docker/getting-started

After the container completes starting, open your web browser and visit the URL http://ServerIP. For example:

http://192.0.2.10

Conclusion

You have installed Docker CE on your Debian 11 server. You can read more on using and managing containers from the getting-started website you just deployed from your server using Docker.