Article 4S5TV docker: umask mounted host volume...

docker: umask mounted host volume...

by
masavini
from LinuxQuestions.org on (#4S5TV)
hi,
is there a way to mount a host volume into a docker container so that it is seen as owned by root instead of a normal user?
this is what i mean...
let's touch a file:
Code:$ echo $USER
teo
$ id -u
1000
$ id -g
1000
$ mkdir /tmp/test
$ touch /tmp/test/t
$ ls -l /tmp/test/t
-rw-rw-r-- 1 teo teo 0 Oct 9 12:47 /tmp/test/t... so far so good.

not let's mount /tmp/test as a host volume in a simple docker container and run the same ls -l command:
Code:$ docker run --rm -v /tmp/test:/tmp/test alpine:3.7 ls -l /tmp/test/t
-rw-rw-r-- 1 1000 1000 0 Oct 9 10:39 /tmp/test/tquestion is:
is there a way to mount /tmp/test so that file t looks owned by container's root user and the output of the last command looks like this?
Code:-rw-rw-r-- 1 root root 0 Oct 9 10:39 /tmp/test/tthanks!latest?d=yIl2AUoC8zA latest?i=2j7-10K1hRY:f7qT9oVV4xQ:F7zBnMy latest?i=2j7-10K1hRY:f7qT9oVV4xQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=2j7-10K1hRY:f7qT9oVV4xQ:gIN9vFw2j7-10K1hRY
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments