Install Docker on Debian 11

These types of tickets are a bummer. Instead of leaving in a written txt how to get up docker in Debian 11, I like to publish it in case someone finds it useful.
However, in the end, it is better to leave these processes well programmed in an ansible playbook.

The installation process of the latest version of docker is more or less this:

# apt install -y apt-transport-https ca-certificates curl gnupg lsb-release sudo
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ 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
# apt update
# apt remove docker docker-engine docker.io containerd runc
# apt install -y docker-ce docker-ce-cli containerd.io
# systemctl is-enabled docker ; systemctl is-enabled containerd
# systemctl status docker containerd

Example of Starting a docker with nginx :

$ docker pull nginx:alpine
$ docker images
$ docker run -it --rm -d -p 8080:80 --name web nginx:alpine
$ docker ps

If everything goes well, you already have docker on the machine to start messing around.

Sincerely.

Leave a Reply