Docker: Install on Debian

root's picture

This is based on official documentation but is simplified just for what I needed and hopefully is useful for you also.

1. Check debian version (in this case it is 10.8 - buster)

# cat /etc/debian_version 
# lsb_release -cs

2. Remove any existing docker installation (older versions that came with the OS, etc.)

NOTE: if nothing is removed, no problems.

# apt remove docker docker-engine docker.io containerd runc

3. Add the official GPG key

# curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4. Add docker repository to apt

NOTE: if in your case the lsb_release command does not provide the desired outout, you need to check yoursefl which version you have and replace $(lsb_release -cs) with the hardcoded value (e.g. buster, stretch, or whatever).

# echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
   $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
# cat /etc/apt/sources.list.d/docker.list

5. Run apt update

NOTE: important to run this command because if not, the next one will not install anything.

# apt update

6. Instal docker with apt

# apt install docker-ce docker-ce-cli containerd.io

And done: docker is installed. Run the following to check

# docker container ls
# ps -ef |grep -i docker

Video format of this tutorial

Links

Official documentation: https://docs.docker.com/engine/install/debian/

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.