Debian Docker installation

Docker supports the following 64-bit Debian versions:

  • Debian Bookworm 12 (stable)
  • Debian Bullseye 11 (oldstable)

Supported architectures include x86_64 (amd64), armhf, arm64, and ppc64le.

Uninstall old versions

If you have previously installed Docker Engine before, you need to uninstall the old version to avoid conflicts:

for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

Install automatically using the official installation script

The installation command is as follows:

 curl -fsSL https://get.docker.com -o get-docker.sh
 sudo sh get-docker.sh


Manual installation

1. Update software packages

First, update existing packages and the package cache

sudo apt update
sudo apt upgrade

2. Install dependency packages

Install some required dependency packages. These packages allow apt to use the HTTPS protocol to access the Docker repository:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

3. Add the official Docker GPG key

Use the following command to add Docker's official GPG key:

sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

4. Add the Docker repository

Add Docker's official APT software repository:

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 更新
sudo apt-get update

5. Update the APT package cache

After adding the repository, update the APT package index

sudo apt update

Make sure you now install Docker from Docker's official repository rather than the Debian default repository:

apt-cache policy docker-ce

You should see it pointing to https://download.docker.com/, and make sure this is the official Docker repository.

6. Install Docker

Now you can install Docker:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

7. Start and verify Docker

Start Docker and enable it to start on boot:

sudo systemctl start docker
sudo systemctl enable docker

You can use the following command to verify whether Docker was installed successfully:

sudo docker --version

Run the following test command to make sure Docker is working properly

sudo docker run hello-world

Uninstall docker

Delete the installation package:

sudo apt-get purge docker-ce

Delete images, containers, configuration files, and other content:

sudo rm -rf /var/lib/docker
other extensions