Ubuntu 18.04.4 LTS - Docker install failed

I am unable to install docker on my ubuntu Os :frowning:

Installation step in error :

$ sudo apt-get install docker-ce docker-ce-cli containerd.io

OS :

Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic

Trace :

Reading package lists… Done
Building dependency tree
Reading package lists… Done
Building dependency tree
Reading state information… Done
containerd .io is already the newest version (1.2.13-1).
containerd .io set to manually installed.
The following NEW packages will be installed:
docker-ce docker-ce-cli
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/65.4 MB of archives.
After this operation, 292 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package docker-ce-cli.
(Reading database … 230412 files and directories currently installed.)
Preparing to unpack …/docker-ce-cli_5%3a19.03.8~3-0~ubuntu-bionic_amd64.deb …
Unpacking docker-ce-cli (5:19.03.8~3-0~ubuntu-bionic) …
Selecting previously unselected package docker-ce.
Preparing to unpack …/docker-ce_5%3a19.03.8~3-0~ubuntu-bionic_amd64.deb …
Unpacking docker-ce (5:19.03.8~3-0~ubuntu-bionic) …
Setting up docker-ce-cli (5:19.03.8~3-0~ubuntu-bionic) …
Setting up docker-ce (5:19.03.8~3-0~ubuntu-bionic) …
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
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 Sun 2020-03-29 13:11:51 UTC; 4ms ago
Docs: https:/ /docs.docker.com
Process: 11276 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 11276 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce (–configure):
installed docker-ce package post-installation script subprocess returned error exit status 1
Processing triggers for systemd (237-3ubuntu10.39) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …
Processing triggers for ureadahead (0.100.0-21) …
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

Thanks for your help !

Hi

Did you manage to fix this? I have the same issue.

A solution is given at https://medium.com/@randima.somathilaka/docker-engine-install-fails-in-ubuntu-3e70762c2187, but I cannot work out how to determine which is the correct version of docker to choose to match the Ubuntu version.

Or can anyone else help?

Many thanks

I fixed this, I think.

In my case (and I don’t know if every step was necessary):

  1. Start with the official Docker instructions at https://docs.docker.com/engine/install/ubuntu/
  2. Run “systemctl status docker.service” and “journalctl -xe” to get details. First error message was ““failed to mount overlay: no such device” storage-driver=overlay2” See https://github.com/docker/for-linux/issues/162
  3. Docker then gives instructions on Overlay at https://docs.docker.com/storage/storagedriver/overlayfs-driver/#prerequisites. I followed these, i.e.
    a. Stop Docker. sudo systemctl stop docker b. Copy the contents of /var/lib/docker to a temporary location. cp -au /var/lib/docker /var/lib/docker.bk
    c. If you want to use a separate backing filesystem from the one used by /var/lib/, format the filesystem and mount it into /var/lib/docker. Make sure add this mount to /etc/fstab to make it permanent.
    d. Edit /etc/docker/daemon.json. If it does not yet exist, create it. Assuming that the file was empty, add the following contents.
    {
    “storage-driver”: “overlay2”
    }
    e. Docker does not start if the daemon.json file contains badly-formed JSON
  4. Still did not work.
  5. As per https://goteleport.com/gravity/docs/ver/5.x/requirements/#overlay-module worked out that Overlay module was missing from kernel.
    a. The overlay kernel module is required if the application is using overlay or overlay2 Docker storage driver (see Application Manifest) for information on how to configure the storage driver). To check that it’s loaded: root$ lsmod | grep overlay
    b. To load the module: root$ modprobe overlay
    c. To make it persist across reboots: root$ echo ‘overlay’ > /etc/modules-load.d/overlay.conf
  6. Managed to install module. I think I used sudo apt-get install --reinstall linux-image-X.XX.XXX-XXX-generic, where the Xs were version numbers
  7. Back to previous point to do modprobe overlay and echo…
  8. sudo docker run hello-world to check. Seems to be working.

Hope this helps. Your issue may be different. For me the key was in slowing down, locating the first error message from “systemctl status docker.service” and “journalctl -xe”, and then Googling on from there with key phrases.