How to Install Docker on Debian 9

Install Docker on Debian 9

In this article, we will have explained the necessary steps to install and configure Docker on Debian 9. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Docker is a free and open-source containerization platform that allows you to quickly build, test and deploy applications as portable, self-sufficient containers that can virtually run everywhere. The containers are similar to a virtual machine but consume fewer resource, easy to manage and can run anywhere regardless of operating environment it is running in.

Install Docker on Debian

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg2

Step 2. Install Docker on Debian 9.

Now, import the repository’s GPG key using the following curl command:

curl -fsSL | sudo apt-key add -

Add the Docker APT repository to your system’s software repository list by typing:

sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

You can simply install the Docker package using following command:

sudo apt update
sudo apt install docker-ce

Once the installation is completed the Docker service will start automatically:

sudo systemctl status docker

The output should be similar to the following, showing that the service is active and running:

● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-02-07 17:02:07 UTC; 1min 46s ago
Main PID: 16988 (dockerd)
CGroup: /system.slice/docker.service

To verify that Docker is installed, run the following command:

docker -v
Docker version 18.06.0-ce, build 0ffa825

Congratulation, you have learned how to install and configure Docker on Debian 9 Stretch. If you have any question, please leave a comment below.