diff --git a/libcontainer/user/user.go b/libcontainer/user/user.go index 7b912bbf8b4..c7373277f05 100644 --- a/libcontainer/user/user.go +++ b/libcontainer/user/user.go @@ -417,11 +417,10 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) ( // Okay, so it's numeric. We can just roll with this. } - } else if len(groups) > 0 { - // Supplementary group ids only make sense if in the implicit form. - user.Sgids = make([]int, len(groups)) - for i, group := range groups { - user.Sgids[i] = group.Gid + } + if len(groups) > 0 { + for _, group := range groups { + user.Sgids = append(user.Sgids, group.Gid) } } }