简体   繁体   中英

File permissions for mounted volumes in image processing pipelines?

We're using docker to containerize some image processing pipelines to make sharing them with collaborators easier.

The current method we're using is to mount an "inputs" directory (which contains an image. ie a single jpg) and an "outputs" directory (which contains the processed data. ie maybe a segmentation of the input image). The problem we're having is we run docker with sudo, and after the processing is complete, the files in the outputs directory have root permissions.

Is there a standard or preferred way to set the files in mounted volumes to have the permissions of the calling user?

Perhaps you can use the --user flag in docker run

eg

docker run --user $UID [other flags...] image [cmd]

Alternatively the following might work (untested)

In Dockerfile ENTRYPOINT "su $USERID -c"

Followed by: ` docker run -e USERID=$UID [other flags...] image [cmd]

Try setting the user in your Dockerfile so that when the container is started it uses 'tomcat' for example.

# example
USER tomcat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM