Install fails on Debian Stretch

Following the guide here:

https://docs.docker.com/install/linux/docker-ce/debian/

It says Debian Stretch is supported, but when I do:

apt install docker-ce docker-ce-cli containerd.io

I get errors:

Setting up docker-ce (5:18.09.2~3-0~debian-stretch) ...
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/dockerd-ce because link group dockerd is broken
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details. invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2019-02-20 20:07:37 CST; 7ms ago
     Docs: https://docs.docker.com
  Process: 6353 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 6353 (code=exited, status=1/FAILURE)
      CPU: 157ms

Feb 20 20:07:37 jupiter systemd[1]: docker.service: Unit entered failed state.
Feb 20 20:07:37 jupiter systemd[1]: docker.service: Failed with result 'exit-code'.
dpkg: error processing package docker-ce (--configure):
 subprocess installed post-installation script returned error exit status 1
 Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

My system is:

# lsb_release -a

No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.8 (stretch)
Release:	9.8
Codename:	stretch```

Any idea?

Did you update the packages first?
sudo apt-get update

I recommend uninstalling and using the simple get.docker.com script.
Does all of the "hard work for you.

Uninstall Docker CE

sudo apt-get remove docker-ce docker-ce-cli -y

Install curl

which curl &> /dev/null || (sudo apt-get update -qq && sudo apt-get install curl -y)

Install docker

curl --silent -SL https://get.docker.com/ | sh

Example

Install curl if it’s not already installed.

🐳  gforghetti@server:[~] $ which curl &> /dev/null || (sudo apt-get update -qq && sudo apt-get install curl -y)
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  containerd.io libltdl7
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  curl
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/159 kB of archives.
After this operation, 395 kB of additional disk space will be used.
Selecting previously unselected package curl.
(Reading database ... 89499 files and directories currently installed.)
Preparing to unpack .../curl_7.58.0-2ubuntu3.6_amd64.deb ...
Unpacking curl (7.58.0-2ubuntu3.6) ...
Setting up curl (7.58.0-2ubuntu3.6) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

Install Docker CE

🐳  gforghetti@server:[~] $ curl --silent -SL https://get.docker.com/ | sh
# Executing docker install script, commit: 40b1b76
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sudo -E sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sudo -E sh -c echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic edge" > /etc/apt/sources.list.d/docker.list
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sudo -E sh -c docker version
Client:
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        6247962
 Built:             Sun Feb 10 04:13:47 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 03:42:13 2019
  OS/Arch:          linux/amd64
  Experimental:     false
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker gforghetti

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.

** DOCKER ENGINE - ENTERPRISE **

Test drive additional security features by activating Docker Engine - Enterprise.

  * Leverage FIPS 140-2 validated encryption
  * Run only trusted images with digital signature enforcement

** Learn more at https://dockr.ly/engine1 **

ACTIVATE your own engine to Docker Engine - Enterprise using:

  sudo docker engine activate

Logout and then log back in so the group setting takes affect.

🐳  gforghetti@server:[~] $ sudo usermod -aG docker gforghetti
🐳  gforghetti@server:[~] $ exit
logout
 $ sudo su - gforghetti
🐳  gforghetti@server:[~] $ docker version
Client:
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        6247962
 Built:             Sun Feb 10 04:13:47 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 03:42:13 2019
  OS/Arch:          linux/amd64
  Experimental:     false
🐳  gforghetti@server:[~] $

I did run apt update.

The “does all the hard work for you” command you sent:

> curl --silent -SL https://get.docker.com/ | sh

also ends in errors and an incomplete install:

# Executing docker install script, commit: 40b1b76
+ sh -c apt-get update -qq >/dev/null
+ sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/debian/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c echo "deb [arch=amd64] https://download.docker.com/linux/debian stretch edge" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
E: Sub-process /usr/bin/dpkg returned an error code (1)

No daemon :frowning:

> docker version

Client:
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        6247962
 Built:             Sun Feb 10 04:13:52 2019
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Hi.

Looking at the output I see this:
Sub-process /usr/bin/dpkg returned an error code (1)
No error message as the script pipes it to /dev/null.

Run this command without piping the output to /dev/null (unlike the get.docker.com script).
I suspect your system has other issues or your root account has issues.

apt-get install -y -qq --no-install-recommends docker-ce

Hoping that displays the error/reason why the install is failing.

Now I’m back to the same error from my initial post:

> apt-get install -y -qq --no-install-recommends docker-ce

Setting up docker-ce (5:18.09.2~3-0~debian-stretch) ...
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/dockerd-ce because link group dockerd is broken
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details. invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Thu 2019-02-21 07:31:44 CST; 8ms ago
     Docs: https://docs.docker.com
  Process: 24620 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 24620 (code=exited, status=1/FAILURE)
      CPU: 151ms

Feb 21 07:31:44 jupiter systemd[1]: docker.service: Unit entered failed state.
Feb 21 07:31:44 jupiter systemd[1]: docker.service: Failed with result 'exit-code'.
dpkg: error processing package docker-ce (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

Found a bug hit.

They say the workaround is just to restart the docker daemon.

systemctl restart docker
> systemctl restart docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.

> systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-02-21 07:53:07 CST; 41s ago
     Docs: https://docs.docker.com
  Process: 25451 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 25451 (code=exited, status=1/FAILURE)
      CPU: 157ms

Feb 21 07:53:04 jupiter systemd[1]: docker.service: Unit entered failed state.
Feb 21 07:53:04 jupiter systemd[1]: docker.service: Failed with result 'exit-code'.
Feb 21 07:53:07 jupiter systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Feb 21 07:53:07 jupiter systemd[1]: Stopped Docker Application Container Engine.
Feb 21 07:53:07 jupiter systemd[1]: docker.service: Start request repeated too quickly.
Feb 21 07:53:07 jupiter systemd[1]: Failed to start Docker Application Container Engine.
Feb 21 07:53:07 jupiter systemd[1]: docker.service: Unit entered failed state.
Feb 21 07:53:07 jupiter systemd[1]: docker.service: Failed with result 'exit-code'.

> journalctl -xe
Feb 21 07:53:07 jupiter systemd[1]: docker.service: Start request repeated too quickly.
Feb 21 07:53:07 jupiter systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit docker.service has failed.
--
-- The result is failed.
Feb 21 07:53:07 jupiter systemd[1]: docker.socket: Unit entered failed state.
Feb 21 07:53:07 jupiter systemd[1]: docker.service: Unit entered failed state.
Feb 21 07:53:07 jupiter systemd[1]: docker.service: Failed with result 'exit-code'.

Try running this command locally from a shell prompt.

sudo /usr/bin/dockerd -H fd://

sudo is non-default on Debian and I don’t have it installed on this system.

As root I did:

/usr/bin/dockerd -H fd://
Failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd

Hi.

I just launched a Debian 9.8 stretch machine and installed Docker CE with no problem.
I also attached the output of a dpkg --list from my system so you can compare packages.
Other than that I don’t have a clue myself what is wrong with your setup.

🐳  gforghetti@server:[~] $ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.8 (stretch)
Release:	9.8
Codename:	stretch
🐳  gforghetti@server:[~] $ uname -a
Linux server 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3 (2019-02-02) x86_64 GNU/Linux
🐳  gforghetti@server:[~] $ curl --silent -SL https://get.docker.com/ | sh
# Executing docker install script, commit: 40b1b76
+ sudo -E sh -c apt-get update -qq >/dev/null

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for gforghetti:
+ sudo -E sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sudo -E sh -c curl -fsSL "https://download.docker.com/linux/debian/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sudo -E sh -c echo "deb [arch=amd64] https://download.docker.com/linux/debian stretch edge" > /etc/apt/sources.list.d/docker.list
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sudo -E sh -c docker version
Client:
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        6247962
 Built:             Sun Feb 10 04:13:52 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 03:42:13 2019
  OS/Arch:          linux/amd64
  Experimental:     false
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker gforghetti

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.

** DOCKER ENGINE - ENTERPRISE **

If you’re ready for production workloads, Docker Engine - Enterprise also includes:

  * SLA-backed technical support
  * Extended lifecycle maintenance policy for patches and hotfixes
  * Access to certified ecosystem content

** Learn more at https://dockr.ly/engine2 **

ACTIVATE your own engine to Docker Engine - Enterprise using:

  sudo docker engine activate

🐳  gforghetti@server:[~] $ sudo usermod -aG docker gforghetti
🐳  gforghetti@server:[~] $ exit
logout
$ sudo su - gforghetti
🐳  gforghetti@server:[~] $ docker version
Client:
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        6247962
 Built:             Sun Feb 10 04:13:52 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 03:42:13 2019
  OS/Arch:          linux/amd64
  Experimental:     false

debian_dpkg_list.txt (74.6 KB)