Docker mount a volume as root

╄→гoц情女王★ 提交于 2019-12-22 14:04:41

问题


The problem description

I have a Docker image, which is being executed with volume mounting options a large number of times. It is built in a way so that the default user does not have root permissions. However I need to make sure that when I mount the volume it is being mounted as root and not as the current working user because of security concerns. (The current working non-root user must not be allowed to delete any files inside the mounted volume.)

Example

From the host machine:

docker run -it -v /path/to/mount:/container/mounting/path image-name

Inside the container current-user@docker-container:

All of the files inside /container/mounting/path must have owner permissions root root and not current-user current-user.

来源:https://stackoverflow.com/questions/32097455/docker-mount-a-volume-as-root

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!