Skip to content

Add rootfs mountpropagation flags - #15648

Closed
rootfs wants to merge 1 commit into
moby:masterfrom
rootfs:rootfs_runc
Closed

rootfs wants to merge 1 commit into
moby:masterfrom
rootfs:rootfs_runc

Conversation

@rootfs

@rootfs rootfs commented Aug 17, 2015

Copy link
Copy Markdown

This is to replace previous pull request #14097. It currently depends on unmerged libcontainer patch from opencontainers/runc#208

Configure rootfs mount propagation through --rootmount flag:
To set the rootfs mount propagation to shared: docker run --rootmount=container_shared fedora
To set the rootfs mount propagation to private: docker run --rootmount=container_private fedora
To set the rootfs mount propagation to slave: docker run --rootmount=container_slave fedora

A sample output of --rootmount=container_shared is

# docker run -ti --net=host --rootmount=container_shared --privileged -v /test:/test centos  findmnt -o TARGET,PROPAGATION |grep test
|-/test                               shared

A sample output of --rootmount=container_slave is

# docker run -ti --net=host --rootmount=container_slave --privileged -v /test:/test centos  findmnt -o TARGET,PROPAGATION |grep test
|-/test                               private,slave

Use cases for different propagation modes are

Propogation Container mounts dir Host mounts dir Use case
1 Shared Both container and host see the dir Both container and host see the dir Use a container to mount filesystems on the host so other containers can see it
2 Slave container sees dir but host cannot Both container and host see the dir automount, etc
3 Private container sees dir but host doesn't host sees dir but container doesn't current default

@pmorie

pmorie commented Aug 17, 2015

Copy link
Copy Markdown
Contributor

RootMount sounds like it might be a path -- what about RootMountMode?

@rootfs

rootfs commented Aug 17, 2015

Copy link
Copy Markdown
Author

@fgrzadkowski

Copy link
Copy Markdown

@rootfs @pmorie
Is there a way to workaround lack of this feature in the current Docker release? Maybe some manual mount --make-rshared / would work here? I've been trying to do it, but couldn't find a proper combination. Any suggestion welcomed :)

@fgrzadkowski

Copy link
Copy Markdown

I'm trying to mount a device from within a container that could be shared with other containers. Using some custom code to do this is also an option (like nsenter somehow).

@rootfs

rootfs commented Aug 26, 2015

Copy link
Copy Markdown
Author

@fgrzadkowski If you want to try nsenter, check out my example

@fgrzadkowski

Copy link
Copy Markdown

@rootfs IIUC glusterfs mounts that happens within your super-privileged container will be caught and then executed in hosts mount namespace, right? Does it also work if docker (1.7) sets rootfs propagation flag to private? Can this be generalized to any mount syscall that happens within this super-privileged container?

@rootfs

rootfs commented Aug 26, 2015

Copy link
Copy Markdown
Author

@fgrzadkowski yes, mount(2) interception is the idea. It should work for docker 1.7 as long as you mount to /host.

It should work for other mount too if you remove this line

@fgrzadkowski

Copy link
Copy Markdown

What's the ETA for this PR to be merged and released?

@fgrzadkowski

Copy link
Copy Markdown

@rootfs

Any ETA for this PR?

@rootfs

rootfs commented Sep 1, 2015

Copy link
Copy Markdown
Author

@fgrzadkowski really need it for docker 1.9

@fgrzadkowski

Copy link
Copy Markdown

To be honest I'm not familiar with docker roadmap. When docker 1.9 should be released?

@rootfs

rootfs commented Sep 1, 2015

Copy link
Copy Markdown
Author

@jdoliner

jdoliner commented Sep 2, 2015

Copy link
Copy Markdown
Contributor

+1

This would be insanely help for us over at Pachyderm.

@bufdev

bufdev commented Sep 2, 2015

Copy link
Copy Markdown
Contributor

Yes +1, although not really any more weight since @jdoliner and I need it for the same thing :)

@GordonTheTurtle

Copy link
Copy Markdown
Contributor

USER POLL

The best way to get notified when there are changes in this discussion is by clicking the Subscribe button in the top right.

The people listed below have appreciated your meaningfull discussion with a random +1:

@childsb

@ahmetb

ahmetb commented Sep 24, 2015

Copy link
Copy Markdown
Contributor

+1

1 similar comment
@pmorie

pmorie commented Sep 24, 2015

Copy link
Copy Markdown
Contributor

+1

@rhvgoyal

Copy link
Copy Markdown
Contributor

I just pushed a new set of patches to my runc PR. That needs to get merged before this we make changes to docker to make use of those new runc features (rootfsPropagation).

opencontainers/runc#208

@unclejack

Copy link
Copy Markdown
Contributor

An option to provide a way to set this would be very useful. There are users out there who've had problems whenever the default mount propagation was changed.

The private mount propagation was set as the default last year (from what I recall) to improve performance, but some have reported problems with the visibility of their mounts.

I don't see how having this option would hurt, especially since it lets everyone get exactly what they need for their use cases.

@mrunalp

mrunalp commented Oct 2, 2015

Copy link
Copy Markdown
Contributor

opencontainers/runc#208 is now merged.

@rhvgoyal

rhvgoyal commented Oct 2, 2015

Copy link
Copy Markdown
Contributor

I have couple of docker patches which make use of new config.RootPropagation field of runc/libcontainer. I will clean them up soon and post. And also compare with these patches and see what is needed and what's not.

@rhvgoyal

rhvgoyal commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

As runc implementation has changed from last time, I created another PR for this issue. New patches are based on newly merged runc patches.

#16773

@icecrime

icecrime commented Oct 7, 2015

Copy link
Copy Markdown
Contributor

@rhvgoyal Closing this one in favor of #16773 then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/needs-attention Calls for a collective discussion during a review session status/1-design-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.