Hello, welcome to my Debian Tutorial series. Today, we are going to learn how to install Docker on Debian 9. Docker is a powerful virtualization software that has been used by millions of developers out there. Docker containers is a revolutionary way to build, deploy and distribute applications across operating systems. This tutorial is based on Debian 9. If you are running an older version of Debian, you can read how to install Docker on Debian 7 or older.
Steps to Install Docker on Debian 9
Uninstall old version
If you have an old version of Docker installed on Debian, you will need to remove it first. The following command will remove any docker installation.
sudo apt-get remove docker docker-engine docker.io
Install Docker CE on Debian 9 via Repository
Docker CE stands for Community Editions which means that this Docker is maintained by Docker’s community. The easiest way to install Docker CE on Debian 9 is via a repository. By installing Docker via PPA repository, you will be able to update Docker in the future.
1.Update Debian
sudo apt update
2. Install package to allow apt to use a repository over HTTPS protocol
sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg2 \ software-properties-common
3. Add Docker’s GPG key
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
4. Setup the repository
sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/debian \ $(lsb_release -cs) \ stable"
5. Install Docker CE
sudo apt update sudo apt install docker-ce
Install Docker CE on Debian 9 using DEB Package
If the above method fails or you may want to install docker using the DEB package, you can download Docker DEB package from the link below.
https://download.docker.com/linux/debian/dists/ Select the Debian version from the list and then go to pool/stable directory.
Select the Docker ce version from the list and save it to your local directory. On this tutorial, I choose and download the docker 18.03 DEB: docker-ce_18.03.1_ce-0_debian_amd64.deb
Now let’s install the package
sudo dpkg -i docker-ce_18.03.1_ce-0_debian_amd64.deb
Once installation complete, check the Docker version with this command
docker --version
Output
At this point, we have successfully installed Docker on Debian. You can start using Docker for your own purposes. We recommend you to install Docker GUI Management tool for ease of use.
Leave a Reply