Published: July 22, 2026
Read: 9 min
In: Technology & Development

Written by

Reviewed by

Last updated: July 20, 2023

Expert verified

SVG Image

TL;DR

To install Docker on Debian, you can follow these steps:

  1. Update the package lists to ensure you have the latest available versions: $ sudo apt update
  2. Upgrade the installed packages to their latest versions for better compatibility and security: $ sudo apt upgrade
  3. Install the necessary packages to enable HTTPS access, which is required to securely communicate with Docker repositories: $ sudo apt install apt-transport-https ca-certificates curl software-properties-common
  4. Add Docker’s official GPG key to verify the integrity and authenticity of the downloaded Docker packages: $ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  5. Add the Docker repository to Debian’s APT sources and update the package lists, allowing the system to recognize and fetch Docker packages: $ 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 > /dev/null && sudo apt update
  6. Finally, install Docker, the containerization platform, along with its necessary components: $ sudo apt install docker-ce docker-ce-cli containerd.io

To effectively manage Docker on Debian, run it as a non-root user, check the Docker version and system status, and validate the installation by running a sample container. Addressing common errors such as connection issues, permissions, package availability, command not found, and socket access will ensure a smooth installation and usage experience with Docker on Debian.

Read the guide below to learn the step-by-step method to install Docker on Debian and common errors that can occur, and how to troubleshoot them.

Docker is an open-source platform that enables developers to package and distribute applications as self-contained containers. These containers encapsulate the application code, along with all its dependencies, into a single, portable unit. With Docker, you can easily deploy applications across different environments without worrying about compatibility issues or system dependencies. In this comprehensive guide, I will walk you through the process to install Docker on Debian, a highly popular and versatile Linux distribution. I will also discuss common errors that can occur when installing and using docker.

How to Install Docker on Debian

To install Docker on Debian, your system needs to meet the following requirements: Debian 9 (Stretch) or newer as the operating system, an x86-64 (64-bit) processor architecture, a Linux kernel version of 3.10 or newer, at least 2 GB of available memory (RAM), and sufficient disk space to accommodate Docker images and containers. To install Docker via the Docker repository, follow these steps:

  1. Open a Terminal window from the application menu.
opening terminal 14
  1. Run the following command to update the package lists:

<strong>$ sudo apt update</strong>
  1. This command will update the package lists to ensure you have the latest available versions.
updating system package list 5
  1. Once the package lists are updated, upgrade the installed packages to their latest versions:

<strong>$ sudo apt upgrade</strong>
  1. During the upgrade process, you might be prompted to confirm package updates. Enter Y to proceed with the upgrades.
upgrading system packages to the latest version
  1. Install the necessary packages to allow apt to use a repository over HTTPS:

<strong>$ sudo apt install apt-transport-https ca-certificates curl software-properties-common</strong>
  1. This command installs the required packages to securely communicate with repositories over HTTPS.
installing necessary packages to use repository
  1. Add Docker’s official GPG key by running the command:

<strong>$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg</strong>
  1. This command adds Docker’s GPG key to ensure the integrity and authenticity of the downloaded packages.
adding docker official GPG key
  1. To Add the Docker repository to Debian’s APT sources execute the command:

<strong>$ 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 > /dev/null</strong>
  1. This command adds the Docker repository to your system’s APT sources, allowing you to install Docker.
adding docker repository to debian sources
  1. Update the package lists to include the Docker repository:

<strong>$ sudo apt update</strong>
  1. This command updates the package lists to include the Docker repository you added in the previous step.
updating package list to include docker repository 1
  1. Finally, install Docker using the following command:

<strong>$ sudo apt install docker-ce docker-ce-cli containerd.io</strong>
  1. This command installs Docker and its dependencies on your Debian system.
installing docker on debian

Configuration of Docker on Debian

After successfully installing Docker on Debian, there are a few post-installation steps to ensure optimal usage and security. By managing Docker as a non-root user, configuring network settings and firewalls, and verifying the installation, you can create a secure and efficient environment for deploying and managing containerized applications.

1. Managing Docker as a Non-Root User

Running Docker as a non-root user is recommended to enhance security and prevent unauthorized access to sensitive system resources. To manage Docker as a non-root user, add your user to the docker group using the following command:

<strong><code>$ sudo usermod -aG docker $USER</code></strong>

Log out of your session and log back in to apply the group changes.

adding user to docker group

2. Checking Docker Version and System Status

Verifying the Docker version and system status is crucial to ensure the correct installation and functioning of Docker on Debian. 

  1. To check the installed Docker version, open a Terminal and run the following command:

<strong>$ docker --version</strong>
  1. The command will display the installed docker version.
checking installed docker version
  1. Additionally, you can check the running status of Docker and obtain system information using the following command:

<strong>$ docker info</strong>
  1. The output will be:
viewing additional info about docker

3. Running a Sample Docker Container

To validate the Docker installation and familiarize yourself with basic container management, you can run a sample Docker container. Follow these steps to run a simple Hello, World! container:

  1. Open a Terminal and execute the following command: