To install Docker on you Debian distribution, first start off by updating the repositories.
If the user name your using Is not in the sudoers file. Add your username to sudoers file. Or login as root by typing “su”
Bullseye install docker
jill@VM-00:~$ sudo apt-get update [sudo] password for jill: Hit:1 http://deb.debian.org/debian bullseye InRelease Hit:2 http://security.debian.org/debian-security bullseye-security InRelease Hit:3 http://deb.debian.org/debian bullseye-updates InRelease Reading package lists... Done
jill@VM-00:~$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release
jill@VM-00:~$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
jill@VM-00:~$ 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
At this stage we need to update the repositories, as result you will see that docker repository was added.
jill@VM-00:~$ sudo apt-get update Hit:1 http://security.debian.org/debian-security bullseye-security InRelease Get:2 https://download.docker.com/linux/debian bullseye InRelease [43.3 kB] Hit:3 http://deb.debian.org/debian bullseye InRelease Hit:4 http://deb.debian.org/debian bullseye-updates InRelease Get:5 https://download.docker.com/linux/debian bullseye/stable amd64 Packages [4,475 B] Fetched 47.8 kB in 0s (102 kB/s) Reading package lists... Done
Finally proceed with the installation. If docker compose is needed, you have one more step to do.
jill@VM-00:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Install docker compose.
jill@VM-00:~$ sudo apt-get install docker-compose
To verify if docker installed correctly, try to run the “hello-world” example as below.
jill@VM-00:~$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:393b81f0ea5a98a7335d7ad44be96fe76ca8eb2eaa76950eb8c989ebf2b78ec0 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/