Is your docker also corrupt after a reboot? (OMV5, Pi4) This might fix it!

  • I stumbled upon this topic because I have the same issue.


    I've ran the following command

    sudo systemctl edit docker.service is the proper way to add overrides/changes...

    and added this to the file

    [Service]

    ExecStartPre=/bin/sleep 30

    StartLimitInterval=300s

    will this fix the issue at hand?


    omv-extras writes the waitLocalFs.conf. So, I wouldn't change that one. And instead of delay, delete all of the files in /etc/systemd/system/docker.service.d/ and try the following (as root):


    Code
    cat <<EOF > /etc/systemd/system/docker.service.d/waitAllMounts.conf
    [Unit]
    After=local-fs.target $(systemctl list-units --type=mount | grep /srv | awk '{ print $1 }' | tr '\n' ' ')
    EOF

    If that works, I will change omv-extras to use that code.

    Here you suggest something to somebody else. Is this something I can try and might have the same effect as the 1st option that I did?

  • will this fix the issue at hand?

    Try it.


    Is this something I can try and might have the same effect as the 1st option that I did?

    Of course you can try it. I don't have a setup that can test everyone's setup to know if any of these things work. If they work for you, great. I don't think you should have to use both options but if that is the only thing that works, then use it.

    omv 5.6.13 usul | 64 bit | 5.11 proxmox kernel | omvextrasorg 5.6.2 | kvm plugin 5.1.6
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • Of course you can try it. I don't have a setup that can test everyone's setup to know if any of these things work. If they work for you, great. I don't think you should have to use both options but if that is the only thing that works, then use it.

    Had solution 1 not working the 1st time but forgot to start the drives so...my bad. 2nd shutdown and startup appears to have worked.


    I've also tryed your solution. Removed all files in /etc/systemd/system/docker.service.d/ and ran the commands as root. I notice it takes longer for docker and the containers to restart about double as long as solution 1.


    Is it correct that solution 1 will always start after 30 seconds, even if the drives are not fully loaded and that your solution will wait for a full startup before starting docker? If so, I prefer your solution as from a programmers perspective, your solution is the preferred one.


    I'll leave this here too.

    If you can't get solution 2 to work due to being unable to log in as root and adding sudo in front ot cat ... does not work, login as your normal user (pi for me) and run sudo -i to go into root user, run the 4 lines from solution 2 and press Ctrl+D to exit back to your user.

  • Is it correct that solution 1 will always start after 30 seconds, even if the drives are not fully loaded and that your solution will wait for a full startup before starting docker?

    Yep. That is why I was opposed to using a time instead of actually waiting for the drives. Unfortunately, my solution doesn't self update if you add/change the drives in the system.

    omv 5.6.13 usul | 64 bit | 5.11 proxmox kernel | omvextrasorg 5.6.2 | kvm plugin 5.1.6
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • So, to fix it, I delayed the docker initialization with 30 sec:

    Bash: /lib/systemd/system/docker.service
    ExecStartPre=/bin/sleep 30
    StartLimitInterval=300s


    Thank you for this tip Bas it saved my reboot headache. I had placed the /data folder of NextCloud on another disk (to allow space...) that obviously took a little longer to mount, compared to Docker startup time, and thanks to this delay I had no Portainer containers not running after each reboot. Thank you!


    Next time I will do things in a little more "proper" way as ryecoaaron suggested and Krowi asked, i.e.


    sudo systemctl edit docker.service


    ...and add the following to the "override" file that will be created:

    Code
    [Service]
    ExecStartPre=/bin/sleep 30
    StartLimitInterval=300s

    Thanks again, everyone.

    OpenMediaVault OMV 4.1.3x on Beelink L55 - Intel i3-5005U - 8GB RAM - Crucial MX500 M.2 (2280) 1TB - Samsung 860 QVO (2.5") 2TB

    Edited 3 times, last by Konsti ().

  • When docker is being installed using omv-extras, an override file is being created to wait with the start of docker until all filesystems mounted in the GUI of OMV are mounted.


    If you installed docker before this change had been implemented, all you have to do is to press the install Docker button again. This will create the override file.


    RE: Docker Containers Starting on Boot Before Volumes are Mounted

    and some posts above


    However, if the time based solution works for you, that is all that matters.

  • Hello macom thank you for your tip. Where is the override file normally located, per your comment?


    As root via SSH, I did systemctl edit docker.service and immediately exited (Ctrl+X). Terminal showed this message:


    Editing "/etc/systemd/system/docker.service.d/override.conf" canceled: temporary file is empty.


    I do not see anything beyond folder /etc/systemd/system/ i.e. no /docker.service.d/ folder there....


    Running OMV 5.6.12-1 on a test home server with Docker reporting version 5:20.10.7~3-0~debian-buster on a rather "clean" installation a few days ago.


    Thank you

    OpenMediaVault OMV 4.1.3x on Beelink L55 - Intel i3-5005U - 8GB RAM - Crucial MX500 M.2 (2280) 1TB - Samsung 860 QVO (2.5") 2TB

  • Follow the link in my previous post. It leads you to a post from ryecoaaron which has the link to the source.


    This solution only works for filesystems that have been available when docker was installed. If you mounted filesystems afterwards, you have to press the install docker button again.

  • Hi,

    I'm running OMV with a raspberry pi 2B.Docker storage is configured on the raspberry SD card so no issue; container persistent storage is located on a usb drive so I face the issue described at reboot (only on 2 containers, I have 6 containers started at boot).

    I tried the delay way proposed here delay docker start but no luck.

    I think my issue is related to external drive mount availability so I tried


    omv-extras writes the waitLocalFs.conf. So, I wouldn't change that one. And instead of delay, delete all of the files in /etc/systemd/system/docker.service.d/ and try the following (as root):


    Code

    Code
    cat <<EOF > /etc/systemd/system/docker.service.d/waitAllMounts.conf
    [Unit]
    After=local-fs.target $(systemctl list-units --type=mount | grep /srv | awk '{ print $1 }' | tr '\n' ' ')
    EOF


    and works!!!
    It takes some time to have containers up & running but now I can rely on those containers also after a power outage :D

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!