-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Support multiple uid/gid mappings [1/2] #10307
base: main
Are you sure you want to change the base?
Conversation
2e0a5a2
to
ac777c9
Compare
26107e7
to
4e7f0ea
Compare
/test pull-containerd-node-e2e |
I'm adding to 2.0 milestone; @containerd/maintainers let me know if anyone thinks it should not be in 2.0 |
cmd/ctr/commands/run/run_unix.go
Outdated
@@ -45,11 +47,11 @@ import ( | |||
) | |||
|
|||
var platformRunFlags = []cli.Flag{ | |||
&cli.StringFlag{ | |||
&cli.StringSliceFlag{ | |||
Name: "uidmap", | |||
Usage: "Run inside a user namespace with the specified UID mapping range; specified with the format `container-uid:host-uid:length`", |
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 the usage string (for this and gidmap) needs to reflect that it is now a slice/list of maps; at least the first clause should end with mapping range(s); could also add at the end a new clause: ", separate multiple mappings with a comma"
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.
After this change, the help message for this option becomes the following.
--uidmap container-uid:host-uid:length [ --uidmap container-uid:host-uid:length ] Run inside a user namespace with the specified UID mapping range; specified with the format container-uid:host-uid:length
I think the additional []
will indicate the option is a slice. But I think updating the "mapping range" to "mapping ranges" was a good call out. I will make the update in the next revision.
Signed-off-by: Henry Wang <henwang@amazon.com>
Enhance user namespace implementation to support multi-entry uid/gid mappings.
This is 1st patch (out of 2) that supports multiple entries of uid/gid configurations. This patch focuses on the "slow" path that requires
chown
on every file in the root FS. uidmapped mounts implementation will be covered in a separate PR.This implementation has changes in the following area:
IdentityMapping
implementation fromidtools
package in Moby.--uidmap, --gidmap
options inctr run
command.An sample command to run a container with remapped
foo
user:I hope the implementation makes sense and I'm looking forward to your feedback :)