Skip to content

Provide an option to specify per container root mount propagation flag - #16773

Closed
rhvgoyal wants to merge 2 commits into
moby:masterfrom
rhvgoyal:rootPropagation
Closed

rhvgoyal wants to merge 2 commits into
moby:masterfrom
rhvgoyal:rootPropagation

Conversation

@rhvgoyal

@rhvgoyal rhvgoyal commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

Recently runc patches got merged where one can specify per container / (root) propagation flags. Backport these patches in docker and add an option --root-propagation to allow per container root
propagation flags. Valid values are [r]private, [r]shared, [r]slave. These are useful when one wants certain volumes to be slave/shared inside containers.

@rhvgoyal

rhvgoyal commented Oct 5, 2015

Copy link
Copy Markdown
Contributor Author

@rhatdan

rhatdan commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

@rhvgoyal
rhvgoyal force-pushed the rootPropagation branch 3 times, most recently from 00aeffa to e89052d Compare October 5, 2015 21:50
@rhvgoyal

rhvgoyal commented Oct 5, 2015

Copy link
Copy Markdown
Contributor Author

@phemer It is. Difference is different implementation. This implementation is based on what has been merged in runc.

@phemmer

phemmer commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

@rhvgoyal sorry, deleted comment as I saw you even commented over there. Didn't notice as I unsubscribed from it a while ago due to "+1" spam.

@mrunalp

mrunalp commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

We will need to bump up the version of runc in docker.

@rhvgoyal

rhvgoyal commented Oct 5, 2015

Copy link
Copy Markdown
Contributor Author

@mrunalp What's the process for bumping runc version. For now I have just taken the relevant pieces from runc and put in first patch.

@mrunalp

mrunalp commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

@rhvgoyal Change commit id in hack/vendor.sh and run it. Adjust docker code to account for the changes and then make a PR. See for e.g. b7a009c

@rhvgoyal

rhvgoyal commented Oct 5, 2015

Copy link
Copy Markdown
Contributor Author

@mrunalp ok, thanks. I will look into it. Possibly create a separate PR to pull in newer runc and rebase this PR on top of that.

@cpuguy83

cpuguy83 commented Oct 6, 2015

Copy link
Copy Markdown
Member

Definitely makes this a bit easier!
I do not like this flag name as I will always misspell it.

@cpuguy83

cpuguy83 commented Oct 6, 2015

Copy link
Copy Markdown
Member

Also, force pushing to the old PR would have been better... I think this is the 3rd implementation? It's really fragmented the conversation.

@bufdev

bufdev commented Oct 6, 2015

Copy link
Copy Markdown
Contributor

@rhvgoyal I may be missing something, but by making RootPropogation an int on the HostConfig struct, this seems to make an issue for the Docker API, specifically https://github.com/docker/docker/blob/master/pkg/mount/flags_unsupported.go. I was going to go add RootPropogation to https://github.com/fsouza/go-dockerclient/blob/master/container.go#L456, but then realized this. Should it be back to a string, and then parse further down?

@bufdev

bufdev commented Oct 6, 2015

Copy link
Copy Markdown
Contributor

Further explanation: assuming RootPropogation is an int on go-dockerclient's HostConfig, I would have done:

import (
  "github.com/docker/docker/pkg/mount"
)
...
hostConfig.RootPropogation = mount.RSHARED
...

Which from a non-linux/freebsd box, will translate to 0...or more to the point, mount flags are platform-specific which is why they're hidden behind _linux.go, _freebsd.go build directives as it is.

@runcom

runcom commented Oct 6, 2015

Copy link
Copy Markdown
Member

@rhvgoyal @mrunalp I'm taking care of bumping libcontainer version here #16795 to unblock other PRs

@rhvgoyal

rhvgoyal commented Oct 6, 2015

Copy link
Copy Markdown
Contributor Author

@runcom Thanks for taking care of moving to newer libcontainer version.

@rhvgoyal

rhvgoyal commented Oct 6, 2015

Copy link
Copy Markdown
Contributor Author

@cpuguy83 Agreed that name is not simple. (--root-propagation). Do you have other ideas on names? In last proposal @rootfs named it --root-mount. Do you like that one better?

@rhvgoyal

rhvgoyal commented Oct 6, 2015

Copy link
Copy Markdown
Contributor Author

@cpuguy83 Last PR was created by @rootfs and I don't have rights to push to that. That's primary reason I created a separate PR. Also I wanted to keep other implementation around so that we could compare the two, if need be.

But if you are particular about it, I can talk to @rootfs, give him my patch and ask him to force push. Do let me know.

@rhatdan

rhatdan commented Oct 6, 2015

Copy link
Copy Markdown
Contributor
--propogation
--volume-propogation
--vol-propogation
--mount-propogation
--mnt-propogation

@rhvgoyal

rhvgoyal commented Oct 6, 2015

Copy link
Copy Markdown
Contributor Author

@rhatdan, I suspect @cpuguy83 finds propagation hard to spell (like --privileged). so may be we need to get rid of propagation instead from proposed solution`

@rhvgoyal

rhvgoyal commented Oct 6, 2015

Copy link
Copy Markdown
Contributor Author

@peter-edge You make a very good point. So if client is running on non-linux system and daemon is running on a linux system then there is no easy way to ask daemon to run container with a particular propagation mode. I think I should change RootPropagation field in HostConfig to string and parse it on daemon and convert into integer. Will rework my patches. Thanks.

@rhvgoyal

rhvgoyal commented Oct 6, 2015

Copy link
Copy Markdown
Contributor Author

@peter-edge Changed patches to keep RootPropagation in Hostconfig as string so that a non-linux based client can specify propagation mode for a linux based daemon.

@rhvgoyal
rhvgoyal force-pushed the rootPropagation branch 2 times, most recently from c968562 to efa6eac Compare October 6, 2015 19:33
@bufdev

bufdev commented Oct 13, 2015

Copy link
Copy Markdown
Contributor

Is this going to be merged soon? There are a lot of people waiting on this,
it seems like the author has done all he can

On Tuesday, October 13, 2015, Tibor Vass [email protected] wrote:

Sorry we had to move this to 1.10

—
Reply to this email directly or view it on GitHub
#16773 (comment).

@apatil

apatil commented Oct 13, 2015

Copy link
Copy Markdown
Contributor

The single flag per container covers our use case as well.

@ghost

ghost commented Oct 14, 2015

Copy link
Copy Markdown

I am also looking forward to this change merging

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

@crosbymichael

Ok, I generated another PR #17034 which allows specifying per volume mount propagation flags. PTAL.

@crosbymichael

Copy link
Copy Markdown
Contributor

@rhvgoyal i was just asking a question, no need to open another PR ;)

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

@crosbymichael I am just trying to make it as simple as possible. So I thought having two implementations will help in make a fair comparison. :-)

@bufdev

bufdev commented Oct 14, 2015

Copy link
Copy Markdown
Contributor

I will personally buy a case of beer for whoever gets this the LGTM
and merge, today - I'll walk over to docker HQ and deliver it, your choice
:)

On Wednesday, October 14, 2015, Vivek Goyal [email protected]
wrote:

@crosbymichael https://github.com/crosbymichael I am just trying to
make it as simple as possible. So I thought having two implementations will
help in make a fair comparison. :-)

—
Reply to this email directly or view it on GitHub
#16773 (comment).

@crosbymichael

Copy link
Copy Markdown
Contributor

@peter-edge my opensouce oath prevents me from accepting bribes ;) i'm reviewing this today anyways

@bufdev

bufdev commented Oct 14, 2015

Copy link
Copy Markdown
Contributor

<3

On Wednesday, October 14, 2015, Michael Crosby [email protected]
wrote:

@peter-edge https://github.com/peter-edge my opensouce oath prevents me
from accepting bribes ;) i'm reviewing this today anyways

—
Reply to this email directly or view it on GitHub
#16773 (comment).

@calavera

Copy link
Copy Markdown
Contributor

--mounts is a very misleading name for this flag. Even if it's harder to type, I think the original --rootfs-propagation was better.

Is there a way to add integration tests for this?
We're also going to need changes in the documentation for the api and the completion scripts before we merge it in.

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

@calavera I personally like --root-propagation better. So first thing is we need to have a consensus on the name and I can change it again, not a problem at all.

I think adding integration tests should be doable. I had added couple of tests to runc. I will look into adding some tests here too.

What are "completion" scripts?

Also please have a look at other PR which introduces per volume propagation flag. I think that one is little more restrictive but is easier to understand.

@rhatdan

rhatdan commented Oct 14, 2015

Copy link
Copy Markdown
Contributor

@rhvgoyal ./contrib/completion/...

@crosbymichael

Copy link
Copy Markdown
Contributor

@rhvgoyal lets go with --root-mount-propagation

sorry for it changing on you.

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

@crosbymichael ok, will change it to --root-mount-propagation.

@rhatdan

rhatdan commented Oct 14, 2015

Copy link
Copy Markdown
Contributor

Yeesh @crosbymichael is a better typist then I am.

Export parseOptions() so that docker code can convert propagation options
[r]private, [r]slave and [r]shared to mount flag integers.

Signed-off-by: Vivek Goyal <[email protected]>
Introduce a new optoin --mounts to specify mount propagation
for /.  This can be useful in getting shared/slave volumes inside container.

For example:

1. To have slave volumes inside containers do following.

   docker run -ti -v /root/mnt-source:/root/mnt-dest --mounts=rslave fedora bash

  Note: This assumes that / on host is either "shared" or "slave". If it is
  not, convert it using "mount --make-slave /"

2. To have shared volumes inside container, do following.

   docker run -ti -v /root/mnt-source:/root/mnt-dest --mounts=shared --cap-add=SYS_ADMIN fedora bash

   Note: This assumes that "/" on host is shared. I have added SYS_ADMIN to
   container so that it can be allowed to do mounts inside container.

Signed-off-by: Vivek Goyal <[email protected]>
@rhvgoyal

Copy link
Copy Markdown
Contributor Author
  • Changed option name to --root-mount-propagation from --mounts
  • Fixed completion scripts
  • Fixed API and commandline documentation.

Will look into writing integration tests now.

@rhatdan

rhatdan commented Oct 15, 2015

Copy link
Copy Markdown
Contributor

I actually like the other patch better, but I am willing to take either.

@calavera

Copy link
Copy Markdown
Contributor

@rhvgoyal please, stop adding docker: as a prefix to your commit messages.

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

@rhatdan Now I am also little more inclined towards per volume propagation switch. That seems little easier to understand and will be little easy to explain to users.

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

@calavera ok, will drop the docker prefix.

@crosbymichael

Copy link
Copy Markdown
Contributor

@rhvgoyal @rhatdan I thought when we originally talked about this change we all agreed on this being a per volume setting. That is why it was weird seeing this PR. Can we close this one and go with the per volume setting?

@rhatdan

rhatdan commented Oct 23, 2015

Copy link
Copy Markdown
Contributor

@crosbymichael Fine with me.

@rhvgoyal

Copy link
Copy Markdown
Contributor Author

Ok, I will close this PR and let us track this in other PR #17034 where per volume propagation properties are specified.

@rhvgoyal rhvgoyal closed this Oct 23, 2015
@thaJeztah thaJeztah removed this from the 1.10 milestone Jan 3, 2016
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.