Reputation: 1
Is it possible to not start a container and/or stop a container if a folder on the host or within my docker-compose exists? I use docker to mount my rclone drive and meegerfs. I’d like to not start mergerfs unless it sees either subfolders in /mnt/cloud on the host or /cloud in the container which I have set at /mnt/cloud:/cloud mounts for rclone.
Upvotes: 0
Views: 199
Reputation: 25579
Depending on the command you need to run on startup, you can do something like this in your CMD
statement in your Dockerfile
CMD [ -d /cloud ] && echo "/cloud exists" || echo "/cloud does not exist"
You can then replace each echo
command with whatever you want to happen when the /cloud
directory exists or doesn't exist.
Upvotes: 1