Installing Docker in Debian 9

Update the installed packages to the latest version:

sudo apt update
sudo apt upgrade


[email protected]:~# apt update
Hit:1 stretch/updates InRelease
Get:2 stretch InRelease [44.8 kB]         
Ign:3 stretch InRelease                              
Hit:4 stretch-updates InRelease
Get:5 stretch/stable amd64 Packages [5,447 B]  
Hit:6 stretch Release                                
Fetched 50.3 kB in 0s (93.8 kB/s)       

Install the dependencies necessary to add a new repository over HTTPS:

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


[email protected]:~#  apt install apt-transport-https ca-certificates curl software-properties-common gnupg2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ca-certificates is already the newest version (20161130+nmu1+deb9u1).
ca-certificates set to manually installed.
The following additional packages will be installed:
gir1.2-glib-2.0 gir1.2-packagekitglib-1.0 libcap2-bin libcurl3 libdbus-glib-1-2 libgirepository-1.0-1 libglib2.0-bin libgstreamer1.0-0 libpackagekit-glib2-18 libpam-cap libpolkit-agent-1-0

Import the repository’s GPG key using the following curl command:

curl -fsSL | sudo apt-key add -


[email protected]:~# curl -fsSL | 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"


[email protected]:~#  add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

Now Install Docker apt package:

sudo apt install docker-ce


[email protected]:~# apt install docker-ce
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/4.9.0-8-amd64/updates/dkms/
DKMS: install completed.
Setting up linux-headers-amd64 (4.9+80+deb9u6) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ..

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

systemctl status docker


[email protected]:~#  systemctl status docker
    ● docker.service - Docker Application Container Engine
    Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
    Active: active (running) since Mon 2019-01-07 08:57:14 EST; 2min 11s ago
    Main PID: 5919 (dockerd)
    Tasks: 12
    Memory: 30.7M
    CPU: 501ms
    CGroup: /system.slice/docker.service
       └─5919 /usr/bin/dockerd -H unix://