LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 10-09-2019, 05:54 AM   #1
masavini
Member
 
Registered: Jun 2008
Posts: 285

Rep: Reputation: 6
docker: umask mounted host volume...


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/t
question 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/t
thanks!
 
Old 10-09-2019, 06:29 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,799

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
t is a file and is owned by 1000:1000. mount will not [be able to] change it.
 
  


Reply

Tags
docker, permission, umask



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Docker Founder Explains What Docker is all About LXer Syndicated Linux News 0 08-21-2014 09:20 PM
LVM Mount Physical Volume/Logical Volume without a working Volume Group mpivintis Linux - Newbie 10 01-11-2014 07:02 AM
umask and permissions: has umask 007 bad side effects? browny_amiga Linux - General 2 09-09-2011 08:01 AM
umask and /usr/bin/umask linux_user2011 Linux - Newbie 6 04-27-2011 02:05 AM
Setting umask, gid and uid for NTFS-3G volume in KDE Media Manager ack_iix Slackware 1 03-14-2009 05:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 12:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration