New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for specifying additional groups. #10717
Conversation
container.AdditionalGroups = make([]int, len(c.GroupAdd)) | ||
|
||
for i, g := range c.GroupAdd { | ||
group, err := strconv.Atoi(g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are just going to atoi() it, why not make it []int instead of []string in the first place? Accepting string means validation is more clumsy and it implies that accepting a group name is in the plans
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thockin I expect review comments that we should probably accept group names. If not, then I can modify the code to use []int all the way up the stack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we accept group names - are they from the host's groups file or the
container's? The latter is much more complicated, no?
On Wed, Feb 11, 2015 at 3:48 PM, Mrunal Patel notifications@github.com
wrote:
In daemon/execdriver/native/create.go
#10717 (comment):@@ -222,3 +227,17 @@ func (d *driver) setupLabels(container *libcontainer.Config, c *execdriver.Comma
return nil
}
+
+func (d *driver) setupAdditionalGroups(container *libcontainer.Config, c *execdriver.Command) error {
- container.AdditionalGroups = make([]int, len(c.GroupAdd))
- for i, g := range c.GroupAdd {
group, err := strconv.Atoi(g)
@thockin https://github.com/thockin I expect review comments that we
should probably accept group names. If not, then I can modify the code to
use []int all the way up the stack.Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/10717/files#r24546022.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they would have to be from the host's groups file. They could be picked from the container but different containers could have same group names mapped to different gids and that kind of defeats the purpose here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the host's groups file is pretty meaningless inside a container,
especially one we have user ns.
I guess I am arguing simpler is better.
On Wed, Feb 11, 2015 at 4:01 PM, Mrunal Patel notifications@github.com
wrote:
In daemon/execdriver/native/create.go
#10717 (comment):@@ -222,3 +227,17 @@ func (d *driver) setupLabels(container *libcontainer.Config, c *execdriver.Comma
return nil
}
+
+func (d *driver) setupAdditionalGroups(container *libcontainer.Config, c *execdriver.Command) error {
- container.AdditionalGroups = make([]int, len(c.GroupAdd))
- for i, g := range c.GroupAdd {
group, err := strconv.Atoi(g)
I think they would have to be from the host's groups file. They could be
picked from the container but different containers could have same group
names mapped to different gids and that kind of defeats the purpose here.Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/10717/files#r24546903.
@tianon @crosbymichael please take a look. Also, what do you think about accepting group names versus just gids here? |
We've already set the precedent that group names are expected to work, and
are expected to come from the container (-u user:group).
This is exactly why I argued that the libcontainer endpoint for this
feature ought top be a string just like user is, since it's libcontainer
that handles converting user:group into uid+gid+supplementary.
|
@tianon @thockin I am not against changing this in libcontainer to look it up like we do for user. I thought that the original use case was around sharing volumes and passing group names couldn't guarantee that as same group name could map to different gids in different containers. If we agree one way or the other the changes could be made easily :) |
The only use case I have is for numeric GIDs. As long as that works, I On Wed, Feb 11, 2015 at 7:11 PM, Mrunal Patel notifications@github.com
|
I agree with the use case, but I'd rather not add another command line flag. What do you think about extending |
So we have to spec the uid in order to spec the gid? That's a bit clunky,
|
IMO the additional flag is a decent way to expose this feature, but I'm not the final say 👍 |
(but I do still think that optionally supporting named groups will be necessary for this to fly, since that's the interface we already expose via |
@thockin Meh indeed, I didn't think of that... |
Flag is okay for me. Names for groups makes sense. |
ping @icecrime @tiborvass @tianon for decision and moving to code-review. |
+1 for |
Go for the flag, as described by @tianon: pushing to |
Not clear where we agreed the lookup will be done though? On the host or in the container? |
In the container, just like arguments to "-u/--user" are. 👍
|
Any traction on this? |
Anyone who wants full control will just use numeric values, I guess, so I On Mon, Apr 27, 2015 at 5:44 PM, Mrunal Patel notifications@github.com
|
Alright, everyone agrees :) I will update libcontainer to change the lookup and send an update PR. |
I have a PR open against libcontainer for the lookup in the container. |
ping @mrunalp |
Updated the PR. I believe the janky failure is a teardown issue and not related to the changes in the PR. |
LGTM |
Docs added as well. Also, all the builds passed :) |
Oh but rebase is required now :( |
fc7e3a1
to
9b1ce1f
Compare
@cpuguy83 Pushed rebase. |
teardown issue on janky again. |
experimental failures look like they are unrelated to this PR. |
@mrunalp and another rebase, sorry. |
9b1ce1f
to
197405c
Compare
Rebased. |
LGTM Ping @ewindisch @NathanMcCauley. |
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
197405c
to
7fb4565
Compare
Rebased. |
that |
Adds support for specifying additional groups.
@jfrazelle Thanks for the merge :) |
Oh wow, merged! Thanks for being so patient @mrunalp! |
Beware that if the |
@jglick Why not use |
See #9360 for why this is needed.
close #9360
This PR adds the functionality to specify additional groups that will be joined by the container process.
libcontainer support was added by docker-archive/libcontainer#322
I will add documents and tests once I get some initial feedback.
Signed-off-by: Mrunal Patel mrunalp@gmail.com