0

Is there any configuration option in docker run, so that if the host volume has no write permissions its fails to run, like a fail fast.

For example:

docker run -v /media/videos:/mnt/av -v /var/log:/var/log -ti --net=host video_service

In above I am mapping the /media/videos on host to container /mnt/av. Basically I have a NGINX RTMP server in container writing videos to /mnt/av. But if on host /media/videos has no write permissions its failing, it doesn't save any videos. So I am looking for any option so docker fails on start(run) only if it has no write permission on host volume rather than starting successfully but later knowing about the issue.

Or if I can force docker to get write permissions on that host path during start up itself.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Chakradhar K
  • 501
  • 13
  • 40

1 Answers1

0

In your Dockerfile, add an entrypoint like this.

ENTRYPOINT ["/home/user/entrypoint.sh"]

That file will be executed before any other commands that you pass to the container.

In /home/user/entrypoint.sh you can check permissions as it is done in this thread.

Bash test if a directory is writable by a given UID?

Community
  • 1
  • 1
kstromeiraos
  • 4,659
  • 21
  • 26