prerequisites, install them if not already present
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
add docker's GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
verify fingerprint, if you want, which should be 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
sudo apt-key fingerprint 0EBFCD88
add repository if on Ubuntu or Debian only
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
On Raspbian this method does not work, you can add a repository manually by running
sudo bash -c "echo 'deb [arch=armhf] https://download.docker.com/linux/raspbian stretch stable' > /etc/apt/sources.list.d/docker.list"
sudo apt update
install docker
sudo apt-get install docker-ce docker-ce-cli containerd.io
list versions available in the repo
apt-cache madison docker-ce
a specific version can be installed as well by
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
verify that Docker CE is installed correctly by running the hello-world image.
sudo docker run hello-world
if you would like to use Docker as a non-root user, consider adding your user to the docker
group
sudo usermod -aG docker your-user
Uninstall docker
sudo apt-get purge docker-ce
Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:
sudo rm -rf /var/lib/docker
Remove the GPG key
sudo apt-key del 0EBFCD88
An alternative way for installing docker compose is to use pip
within the virtual environment i.e.
for reference python -m pip install docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose
make this binary file executable
sudo chmod +x /usr/local/bin/docker-compose
and create a symbolic link to the /usr/bin
folder
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose