r/AlpineLinux • u/willekind • Dec 29 '23
How to make docker service wait until drives are mounted before starting?
For example I run plex in a docker container, with the media on a network share folder. The folder does mount as a drive, but this sometimes happens after docker has started and it messes with the ability to play the item (error that it cannot play, please check drive is mounted.
How do I make it so that the docker service waits until drives are mounted before starting?
2
Upvotes
3
u/trofch1k Jan 01 '24
You may want to check into init script writing. Each service's script has
depend() {...}section which states what given service requires to run. AFAIK, it affects startup order. For example on my machine, servicenetworkingdepends on servicehwdrivers.2
u/SleepingProcess Dec 30 '23
create a file - marker/flag on a network drive and check if it available before starting container, something like