Docker is a virtualization products used to deliver software in packages called containers. It is used to deliver packages in lightweight containers so that applications can work efficiently in different environments in isolation.
The first step is to add the Docker repository so that it is updated automatically.
First, add Docker's official GPG key:
sudo apt update
sudo apt 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
After that, 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 update
After that, it is possible to install all the necessary packages.
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
To check that the installation went well and everything is running smoothly, run
sudo docker run hello-world
In the following, I will give some quick commands to use:
sudo docker compose up -d
docker compose stop NAME-OF-THE-CONTAINER
docker system prune -f
docker ps
docker exec -it NAME-OF-THE-CONTAINER COMMAND