Install Docker on Debian Stretch
Uninstall older version
Older versions of Docker were called docker
or docker-engine
. If these are installed, uninstall them:
$ sudo apt-get remove docker docker-engine docker.io
Install Docker CE
Install using the repository
- Install packages to allow apt to use a repository over HTTPS:
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
- Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
- Use the following command to set up the stable repository.
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
- Install Docker CE
$ sudo apt-get update
$ sudo apt-get install docker-ce
- Verify that Docker CE is installed correctly by running the hello-world image.
$ sudo docker run hello-world
Install from a package
-
Go to
https://download.docker.com/linux/debian/dists/
, choose your Debian version, browse topool/stable/
, chooseamd64
and download the .deb file for the Docker CE version you want to install. -
Install Docker CE, changing the path below to the path where you downloaded the Docker package.
$ sudo dpkg -i /path/to/package.deb
The Docker daemon starts automatically.
- Verify that Docker CE is installed correctly by running the hello-world image.
$ sudo docker run hello-world
Install using the convenience script
Docker provides convenience scripts at get.docker.com for installing edge and testing versions of Docker CE into development environments quickly and non-interactively. The source code for the scripts is in the docker-install repository. However, using these scripts is not recommended for production environments
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
Uninstall Docker CE
- Uninstall the Docker CE package
$ sudo apt-get purge docker-ce
However, images, containers, volumes, or customized configuration files on your host are not automatically removed.
- Delete all images, containers, and volumes
$ sudo rm -rf /var/lib/docker