-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Description
There is a way to specify user, group, and additional groups in the OCI spec here. It is very clear from the spec that all the fields are numeric UIDs and GIDs.
Yet,
-
In libcontainer these fields are strings:
Lines 29 to 35 in b322e31
// User will set the uid and gid of the executing process running inside the container // local to the container's user and group configuration. User string // AdditionalGroups specifies the gids that should be added to supplementary groups // in addition to those that the user belongs to. AdditionalGroups []string -
So,
runcconverts from numeric UID and GID to a string (like "$UID:$GID"):
Lines 51 to 52 in b322e31
| // TODO: fix libcontainer's API to better support uid/gid in a typesafe way. | |
| User: fmt.Sprintf("%d:%d", p.User.UID, p.User.GID), |
and does the same for additional GIDs:
Lines 72 to 74 in b322e31
| for _, gid := range p.User.AdditionalGids { | |
| lp.AdditionalGroups = append(lp.AdditionalGroups, strconv.FormatUint(uint64(gid), 10)) | |
| } |
- libcontainer parses the whole nine yards of
/etc/passwdand/etc/groupto find out the numeric UID and GID back from theUserstring, and does the same for every additional GID.
I imagine that makes every runc run and runc exec slower than it could be, and is totally unnecessary.
I propose to remove this functionality of resolving user/group names from libcontainer, and only read /etc/passwd in case $HOME is not set.
Metadata
Metadata
Assignees
Labels
No labels