Dietpi: Docker install fails to startup after installation

Created on 13 Nov 2018  Β·  8Comments  Β·  Source: MichaIng/DietPi

Creating a bug report/issue:

Required Information:

  • DietPi version | 6.17.12
  • Distro version | 9.6
  • Kernel version | Linux DietPi 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
  • SBC device | Virtual Machine (x86_64) also on RP3 and UX4
  • Power supply used | N/A
  • SDcard used | N/A

Additional Information (if applicable):

  • Software title | docker
  • Was the software title installed freshly or updated/migrated? Fresh install
  • Can this issue be replicated on a fresh installation of DietPi? Yes
  • dietpi-bugreport ID

Steps to reproduce:

  1. Install Docker via dietpi-software
  2. Docker will fail to start via systemd

Expected behaviour:


Docker should start

Actual behaviour:


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

Extra details:


The problem is the userdata location line when docker is started.

In /DietPi/dietpi/dietpi-software there is a line:

Set container(s) locations in /lib/systemd/system/docker.service

sed -i "/ExecStart=\/usr\/bin\/dockerd/c\ExecStart=\/usr\/bin\/dockerd -g $G_FP_DIETPI_USERDATA\/docker-data -H fd:\/\/" /lib/systemd/system/docker.service

This line breaks docker startup by setting /lib/systemd/system/docker.service to
ExecStart=/usr/bin/dockerd -g /mnt/dietpi_userdata/docker-data -H fd://

This should be
ExecStart=/usr/bin/dockerd -g /mnt/dietpi_userdata/docker-data -H unix://

Bug Debian Buster Debian Stretch Solution available

All 8 comments

@mspieth376
Thanks for report and fix. Will validate on Jessie and Buster systems as well, then merge accordingly for v6.18.

Testing:

  • [x] Stretch: fd:// does not work, unix:// does
  • [x] Jessie: fd:// DOES work!, unix:// works as well
  • [x] Buster: fd:// does not work, unix:// does

Interesting, official packaging repo service unit still contains fd://: https://github.com/docker/docker-ce-packaging/blob/master/deb/systemd/docker.service

Generally I don't like editing systemd units directly. If really, better move it into a docker.service.d/dietpi.conf file, but:

Opened PR: https://github.com/Fourdee/DietPi/pull/2247

Testing for running of Docker after install + reboot:

  • 🈯️ VM
  • 🈴 RPi, service hangs on start
root@DietPi:~# systemctl status docker -l
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset:
enabled)
   Active: activating (start) since Fri 2018-11-16 16:51:21 GMT; 3min 32s ago
     Docs: https://docs.docker.com
 Main PID: 944 (dockerd)
      CPU: 340ms
   CGroup: /system.slice/docker.service
           └─944 /usr/bin/dockerd -H unix://

Nov 16 16:51:21 DietPi systemd[1]: Starting Docker Application Container Engine.
..

image
-- 🈯️ SIGTERM on systemctl start docker

  • 🈴 Odroid C2
 DietPi-Software
─────────────────────────────────────────────────────
 Mode: Configuring Docker: Build, ship, and run distributed applications

/DietPi/dietpi/dietpi-software: line 11879: /etc/docker/daemon.json: No such file or directory

-- non x86, uses docker-engine package. /etc/docker does not exist.


🈯️ Service type "simple" fixes RPi service failure. Previously notify.

root@DietPi:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
61e750ce94d2: Pull complete
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
Status: Downloaded newer image for hello-world:latest

Hello from Docker!

log: https://pastebin.com/mZBRRNsm

Hmm, with RPi, systemctl start docker hangs during boot.

  • Does not occur every reboot.
  • Clears after 10-60 seconds
  • Running docker images during the service hangs, works fine.

Downside is it prevents dietpi-services start from continuing, until Docker is finished loading.

Will set service type to simple, to prevent the above.

Retest:

  • 🈯️ VM
  • 🈯️ RPi

@MichaIng

Great work Micha on fix, works a charm, completed.

@Fourdee
Great non-x86 fix as well.

As long as we cannot find the reason for the hang, this is the best we can do.

Perhaps docker requires something else to start-up? Is there some log that gives an indication?
But actually funny since dietpi services starts it at end of boot, later than how systemd would do :thinking:.

So default APT install with systemd control should have the same issue then, perhaps we can find something about it in web, RPi + docker...

Hello everybody, I believe to be the main responsible to have found out about this bug (https://dietpi.com/phpbb/viewtopic.php?f=11&t=5227) but to me the workaround does not work.
Do you know if there is a solution or if you want I can paste some logs if you tell me which commands to give. Sorry, I am very newbie to Docker.

Lol, on official repo, fd:// is again in service file, working well now on Stretch...
Indeed best to not touch service file directly, if it is changed back and forth πŸ˜„.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oshank picture oshank  Β·  3Comments

and09 picture and09  Β·  3Comments

Fourdee picture Fourdee  Β·  3Comments

Invictaz picture Invictaz  Β·  3Comments

1021683053 picture 1021683053  Β·  3Comments