Due to the implementation of api.go which reads only /etc/group, it is impossible to rely on other auth mechanisms (e.g. LDAP, NIS).
groups, err := ioutil.ReadFile("/etc/group")
if err != nil {
return err
}
re := regexp.MustCompile("(^|\n)docker:.*?:([0-9]+)")
if gidMatch := re.FindStringSubmatch(string(groups)); gidMatch != nil {
gid, err := strconv.Atoi(gidMatch[2])
if err != nil {
return err
}
utils.Debugf("docker group found. gid: %d", gid)
if err := os.Chown(addr, 0, gid); err != nil {
return err
}
}
Instead, the getgrnam syscall should be used to determine, whether a docker group exists or not.
The implemenation of lookup_unix.go in the user Go package might serve as inspiration on how to do this.
Due to the implementation of api.go which reads only
/etc/group, it is impossible to rely on other auth mechanisms (e.g. LDAP, NIS).Instead, the
getgrnamsyscall should be used to determine, whether adockergroup exists or not.The implemenation of
lookup_unix.goin theuserGo package might serve as inspiration on how to do this.