Somehow after updating packages, docker won't start anymore.
Trying to start the daemon, it fails.
pi@raspberrypi:~ $ sudo systemctl start docker.service
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
Trying to run it manually, it terminates and shows an error:
pi@raspberrypi:~ $ sudo dockerd
INFO[...] Starting up
...
...
failed to start daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: overlay2, devicemapper; Please cleanup or explicitly choose storage driver (-s )
We found the problem. It looks like it could not decide it's own storage driver. There are 'overlay2' and 'devicemapper' to choose from.
From Docker's official website [
link], the 'overlay2' is recommended.
Let's try to force it to use this one by adding this parameter to the command: "-s overlay2"
pi@raspberrypi:~ $ sudo dockerd -s overlay2
OR use a more readable version: "--storage-driver=overlay2".
pi@raspberrypi:~ $ sudo dockerd --storage-driver=overlay2
INFO[...] Starting up
...
...
INFO[...] Daemon has completed initialization
INFO[...] API listen on /var/run/docker.sock
Now it works.
Press [Ctrl-c] to exit.
We know how to fix it.
TL;DR: We just need to add the parameter to the service script
pi@raspberrypi:~ $ sudo vi /lib/systemd/system/docker.service
Look for a line with "ExecStart" append "--storage-driver=overlay2" to the line, so it looks like this:
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --storage-driver=overlay2
Then reload the configuration and start the service
pi@raspberrypi:~ $ sudo systemctl daemon-reload
pi@raspberrypi:~ $ sudo systemctl start docker.service