[Solved] Docker does not start on clean image on RaspberryPi3

Having issues with your DietPi installation, or, found a bug? Post it here.
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

[Solved] Docker does not start on clean image on RaspberryPi3

Post by Garret »

I have a Raspberry Pi 3 Model B where I just have put a clean install of DietPi. The system updates to v.6.17.12 and then I install only the Docker software via the Optimized software (#162 on the software list).

However, I can see this fails to start when the system reboots. This is confirmed also when I try to run a container:

Code: Select all

root@livingroom:~/docker-transmission-openvpn# docker build -t transmission-openvpn -f Dockerfile.armhf .
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
The "systemctl status docker -l" returns this message:

Code: Select all

root@livingroom:~# systemctl status docker -l
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2018-11-10 12:08:47 CET; 10min ago
     Docs: https://docs.docker.com
  Process: 1166 ExecStart=/usr/bin/dockerd -g /mnt/dietpi_userdata/docker-data -H fd:// (code=exited, status=
1/FAILURE)
 Main PID: 1166 (code=exited, status=1/FAILURE)
      CPU: 297ms

Nov 10 12:08:45 livingroom systemd[1]: docker.service: Unit entered failed state.
Nov 10 12:08:45 livingroom systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 10 12:08:47 livingroom systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Nov 10 12:08:47 livingroom systemd[1]: Stopped Docker Application Container Engine.
Nov 10 12:08:47 livingroom systemd[1]: docker.service: Start request repeated too quickly.
Nov 10 12:08:47 livingroom systemd[1]: Failed to start Docker Application Container Engine.
Nov 10 12:08:47 livingroom systemd[1]: docker.service: Unit entered failed state.
Nov 10 12:08:47 livingroom systemd[1]: docker.service: Failed with result 'exit-code'.
root@livingroom:~#
Do you have an idea why this happens and if it can be fixed?
mspieth
Posts: 7
Joined: Fri Jan 13, 2017 9:42 pm

Re: Docker does not start on clean image on RaspberryPi3

Post by mspieth »

edit: /lib/systemd/system/docker.service

replace
ExecStart=/usr/bin/dockerd -g /mnt/dietpi_userdata/docker-data -H fd://
with
ExecStart=/usr/bin/dockerd -g /mnt/dietpi_userdata/docker-data -H unix://
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

Re: Docker does not start on clean image on RaspberryPi3

Post by Garret »

Thank you @mspieth. Actually I solved the issue by starting from a new fresh DietPi installation and installed Docker from the command:
curl -sSL https://get.docker.com | sh
Do you know if this bug on the Docker optimized software from DietPi will be fixed?
mspieth
Posts: 7
Joined: Fri Jan 13, 2017 9:42 pm

Re: Docker does not start on clean image on RaspberryPi3

Post by mspieth »

It works for you now because dietpi-software is the problem not the actual docker install. 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. I'll post a bug report on github.
Garret
Posts: 52
Joined: Sat Nov 10, 2018 12:23 pm

Re: Docker does not start on clean image on RaspberryPi3

Post by Garret »

Thanks @mspieth, I had figured out that the problem was in the dietpi-software. I am happy now because in the end I managed but I hope they can fix it so next time I can install docker from the optimized software.
mspieth
Posts: 7
Joined: Fri Jan 13, 2017 9:42 pm

Re: Docker does not start on clean image on RaspberryPi3

Post by mspieth »

I submitted a bug report for this issue.
norrin
Posts: 11
Joined: Wed Oct 24, 2018 9:42 am

Re: Docker does not start on clean image on RaspberryPi3

Post by norrin »

Nice to read this.
Just wanted to install docker.
Do you write here when it is repaired or how to fix it?
odroid XU4
mspieth
Posts: 7
Joined: Fri Jan 13, 2017 9:42 pm

Re: Docker does not start on clean image on RaspberryPi3

Post by mspieth »

Until the bug is fixed within dietpi, it's easy to fix on your own.

1. Install docker #162 normally via dietpi-software.
2. At the end of the install, docker will fail to start, thats ok for now.
3. nano /lib/systemd/system/docker.service
4. Find the line that says: ExecStart=/usr/bin/dockerd -g /mnt/dietpi_userdata/docker-data -H fd://
5. Either delete that line or comment it out by adding a # in front of the line.
6. Add the following line just below the original line: ExecStart=/usr/bin/dockerd -g /mnt/dietpi_userdata/docker-data -H unix://
7. Save the file
8. service docker start

That's it.
You could also just edit the above mentioned file and replace the fd:// with unix://
norrin
Posts: 11
Joined: Wed Oct 24, 2018 9:42 am

Re: Docker does not start on clean image on RaspberryPi3

Post by norrin »

Perfect.
I will try and report.
Thanks.

EDIT:
I had to "systemctl daemon-reload" before i could start the docker service but now it runs.
Thanks a lot one more time!
odroid XU4
mspieth
Posts: 7
Joined: Fri Jan 13, 2017 9:42 pm

Re: Docker does not start on clean image on RaspberryPi3

Post by mspieth »

Sorry..

Forgot about that... Yes you have to reload systemd or it won't know you changed the file.
Post Reply