Skip to content

Instantly share code, notes, and snippets.

@sanrandry
Created December 16, 2020 20:24
Show Gist options
  • Save sanrandry/85dda8ea4af166e4c78dd326186db3d2 to your computer and use it in GitHub Desktop.
Save sanrandry/85dda8ea4af166e4c78dd326186db3d2 to your computer and use it in GitHub Desktop.
docker

unsinstall older version

sudo apt-get remove docker docker-engine docker.io containerd runc

set up the repository

update

sudo apt-get update

install packages to allow apt to use a repository over HTTPS

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.

sudo apt-key fingerprint 0EBFCD88

Use the following command to set up the stable repository

Note: The lsb_release -cs sub-command below returns the name of your Debian distribution, such as helium. Sometimes, in a distribution like BunsenLabs Linux, you might need to change $(lsb_release -cs) to your parent Debian distribution. For example, if you are using BunsenLabs Linux Helium, you could use stretch. Docker does not offer any guarantees on untested and unsupported Debian distributions.

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

INSTALL DOCKER ENGINE

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Verify that Docker Engine is installed correctly by running the hello-world image.

sudo docker run hello-world

Uninstall Docker Engine

Uninstall the Docker Engine, CLI, and Containerd packages

sudo apt-get purge docker-ce docker-ce-cli containerd.io

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
sudo rm -rf /var/lib/containerd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment