Skip to content

Add --rootmount={shared:private:slave} flags to set rootfs mount - #14097

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

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

Conversation

@rootfs

@rootfs rootfs commented Jun 22, 2015

Copy link
Copy Markdown

This is the docker part of docker-archive/libcontainer#632

It implements a rootfs mount propagation flag

@phemmer

phemmer commented Jun 22, 2015

Copy link
Copy Markdown
Contributor

If i'm reading the linked issue correctly, this would close #10088

@rootfs

rootfs commented Jun 22, 2015

Copy link
Copy Markdown
Author

@phemmer we indeed have similar use case.

@rhatdan

rhatdan commented Jul 10, 2015

Copy link
Copy Markdown
Contributor

We need to get a move on this, This is critical to us for docker-1.8. We are carrying a patch but k8s and openshift communities on non Red Hat Platforms need to get the rootfs to be slave not private.

@rhatdan

rhatdan commented Jul 14, 2015

Copy link
Copy Markdown
Contributor

@rootfs Could you make this patch match the one you have for runc.

@rootfs
rootfs force-pushed the rootmount branch 2 times, most recently from 8e8af39 to 0e593c5 Compare July 14, 2015 22:17
@rootfs

rootfs commented Jul 14, 2015

Copy link
Copy Markdown
Author

@rhatdan here you go rootfs/runc@b68acd7

@LK4D4

LK4D4 commented Jul 23, 2015

Copy link
Copy Markdown
Contributor

runc PR opencontainers/runc#77

@timothysc

Copy link
Copy Markdown

@kelseyhightower, @thockin - can we unite and get some leverage on this one?

@rootfs

rootfs commented Aug 3, 2015

Copy link
Copy Markdown
Author

thanks @timothysc. A docker prototype that included opencontainers/runc#77 can be evaluated from here

@thockin

thockin commented Aug 5, 2015

Copy link
Copy Markdown
Contributor

My biggest fear here is that this is a really complicated semantic which is really useful in a small set of cases. But I don't have a better answer - this is certainly better than using nsenter to jump between NSes. I suspect only 2 of the 3 modes are actually useful, but it's hard to make a case to exclude 1/3 of a kernel feature. Not sure how this applies to other Docker platforms...

TL;DR +1

@thockin

thockin commented Aug 5, 2015

Copy link
Copy Markdown
Contributor

@icecrime is there any philosophical objection to this? It's unfortunately a bit complex, but your own example of FUSE daemons in containers is exactly right.

@childsb

childsb commented Aug 5, 2015

Copy link
Copy Markdown

For many filesystems that use FUSE daemons, long-running client baggage and configs are required on the host.

With this patch we could containerize all of that headache and really make filesystem access portable across platforms without the setup and daemon dogma on the host. Imagine connecting to cinder shares on a host without installing complicated nova packages... Its all in a container cleanly hidden away. The host just sees a mountpoint that the container put there.

HUGE +1 .. This would be an incredible feature. I beg of the docker higher powers... We have lots of exciting guides, articles, and everything else boiling around this particular design. Please merge!!!! @cpuguy83

@jayunit100

Copy link
Copy Markdown

I guess we cant technically +1 cause its not mergeable, but definetly +1 pending rebase, lets get this guy in. the value of containerizing pluggable storage for the docker ecosystem as a whole is undeniable.

@cpuguy83

cpuguy83 commented Aug 5, 2015

Copy link
Copy Markdown
Member

This is a super low-level control... but we do need something like this especially for containerizing volume plugins.
Since we can't really share mount namespaces between containers/host this seems to be the path forward for this kind of functionality.

I'd like the discuss the implications of this, though.
I would prefer to make sure people don't mount stuff without dong it in a volume. Basically prevent docker run --rootmount=shared myimage bash -c 'mount <opts> /foo' and then people consuming /var/lib/docker/<graph dir>/<container id>/foo directly.

So I guess the real issue is, can we solve a specific use case vs a generic option that will be abused.

@rootfs

rootfs commented Aug 5, 2015

Copy link
Copy Markdown
Author

@cpuguy83 nice point. For your example, I think the way the patch being implemented doesn't allow people consuming directories under /var/lib/docker/<graph dir>/<container id>/foo directly. The mountpoint can only be created the host, because in the latest code, the rootfs is marked private. So it is more like the following scenario:

docker run --rootmount=shared myimage -v /:/host bash -c 'mount <opts> /host/foo'

rootfs referenced this pull request in rootfs/runc Aug 10, 2015
rootfs referenced this pull request in rootfs/docker Aug 10, 2015
@cpuguy83

Copy link
Copy Markdown
Member

@rootfs what's the use-case for slave?

@rhatdan

rhatdan commented Aug 12, 2015

Copy link
Copy Markdown
Contributor

We are preparing a new pull request for this. With everyone at Red Hat in agreement. :^)

slave is for the autofs and k8s use case. Basically you want to mount a volume into a container, and then any mounts on top of that volume will show up inside the container.

@cpuguy83

Copy link
Copy Markdown
Member

@rhatdan Doesn't this already happen today, assuming the daemon isn't in it's own mount namespace?

@rootfs

rootfs commented Aug 13, 2015

Copy link
Copy Markdown
Author

@cpuguy83 I don't think containers can see new mounts propagated from host, since the rootfs propagation is private

@rhatdan

rhatdan commented Aug 13, 2015

Copy link
Copy Markdown
Contributor

@cpuguy83 No it does not since libcontainer reverted my patch.

libcontainer does a mount --make-rprivate /
during setup, which basically isolates the container from its parents mount namespace.

The change we are trying to get is basically

mount --make-rslave /

Which fixes the use case.

We are also working on

mount --make-rshared /

For the SPC use case of mount client commands wanting to mount file systems onto the parents mnt namespace. (Cefs,Cluster, nfs for example)

@rootfs

rootfs commented Aug 17, 2015

Copy link
Copy Markdown
Author

Closed, please comment on the new PR #15648

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants