Problem
I have my hard drives encrypted with LUKS. Passphrase to unlock drives can be only typed in in the OMV WebUI. I don't want to use auto unlock. Encrypted hard drives have directories that are in use by some of mine Docker containers (nextcloud, transmission). I don't want let those containers to start before the unlock. It will fail, produce some garbage on the filesystem and then I will have manually restart those containers.
Fix
We need script that will wait for the unlock and only then start Docker service
Script
You can copy the code from my GitHub (wait-for-unlock.sh) and put it to /usr/local/bin/ or just download it directly from your device:
sudo wget -P /usr/local/bin/ https://raw.githubusercontent.com/Virusmater/OdroidXU4-Cloudshell2-OMV/master/usr/local/bin/wait-for-unlock.sh
sudo chmod a+x /usr/local/bin/wait-for-unlock.sh
Docker Service
Make an override of an existing configuration
and add the script execution before the start
that will create file /etc/systemd/system/docker.service.d/override.conf with that configuration. You can also check it on GitHub (override.conf)
Final
Script wait-for-unlock.sh is quite dummy and checks only for "/dev/mapper/sda-crypt" device. Any other ideas and PRs are welome!
From now on Docker service will wait for the unlock before starting any containers.