I have container that downloads data to an external hard drive I have set the volume in docker-compose for the service as:
- /media/user/hdd:/hdd
hdd
is the mount point. The problem is that sometimes hard drive doesn’t get mounted on the host and instead the host passes the OS filesystem to docker container which happily takes it and starts writting data to it. I want to add a check to verify the mount points UUID before passing it to docker so it knows that it is infact the external hard drive. I tried healthcheck but that runs inside the container and I don’t know how to make it work, can someone give me pointers?
Here is my UUID condition for my mount point on host:
if[[$ (findmnt - no uuid - T "/media/user/hdd") =
"$MY_UUID"]];
then echo "UUIDs match";
else
echo "UUIDs don't match";
fi