Install Docker® Engine

Before you install the Docker® Engine on a new host computer for the first time, you must set up the Docker® apt repository. You can then install and update Docker® via the repository.

Proceed as follows:

1. Set up the Docker® apt repository:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
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


# Add the repository to Apt sources:
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
2. Install the latest Docker® packages:

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

Test Docker® installation

Use the following command to test whether Docker® is running correctly on the system:

sudo systemctl status docker

This command displays the current status. If Docker® is running correctly, the status should be active (running).

In addition, you can start a simple Docker® container to check whether Docker® works. To do this, execute the following command:

sudo docker run hello-world

This command downloads the hello-world image from Docker® Hub and starts a container. If Docker® is installed correctly, a corresponding message is displayed.