Delete any outdated packages:
sudo apt-get purge docker lxc-docker docker-engine docker.io
Update the default respository:
sudo apt-get update
Download the following dependencies:
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
Download Docker’s official GPG key to verify the integrity of packages
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
Add the Docker repository to your system repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable"
Update the apt repository:
sudo apt-get update
Install Docker Engine and containerd:
sudo apt-get install docker-ce docker-ce-cli containerd.io
Check the status by typing:
systemctl status docker
Another way to check the installation:
docker -v
Optional: Verify the Installation With a Hello World Image
docker run hello-world
To remove docker:
sudo apt-get purge docker-ce
sudo rm -rf /var/lib/docker
docker run -it debian