How to Install Docker on Debian 9.1

Just like SSL, Docker has made it way up the ‘nice-to-have’ things list to among the top five ‘must-haves.’ The unprecedented success of lightweight containers is a reflection of just how useful (and not to mention, light on resources) this service is for DevOps teams.


If you’re running the 9.1 (codenamed ‘Stretch’) version of the Debian Linux, installing Docker is pretty easy.


As a prerequisite, you need to install support for SSL-based HTTP connections, as well as the dirmngr package that will allow Docker to manipulate your file system:


# apt-get install apt-transport-https dirmngr


Once this is done, you can add the Docker repository:


# echo ‘deb debian-stretch main’ >> /etc/apt/sources.list


After this, you need to add this repository’s keys to your main database, so that your system trusts this installation as authentic:


# apt-key adv –keyserver hkp:// –recv-keys 58118E89F3A912897C070ADBF76221572C52609D

# apt-get update


Finally, installing the main thing:


# apt-get install docker-engine


And that’s it! With this, Docker is up and running on your Debian 9.1 machine.