mirror of https://github.com/perkeep/perkeep.git
client/android: fix container detection for docker in systemd cgroup
It seems that on other (more modern?) configurations, the cgroup for processes in docker is /system.slice/docker.service instead of /docker. I have not been able to reproduce such a configuration. But until we have a better way to detect whether a process is in docker, it's probably ok to just add the new path to validate the detection, which this change does. Fixes #973 Change-Id: I9d52bcd79a906fdc1f8310b2c8063930cf9807fb
This commit is contained in:
parent
32fbc99a66
commit
0837889762
|
@ -152,7 +152,8 @@ func inDocker() bool {
|
|||
if len(fields) != 3 {
|
||||
log.Fatal(`unexpected line in "/proc/self/cgroup"`)
|
||||
}
|
||||
if !strings.HasPrefix(fields[2], "/docker/") {
|
||||
if !(strings.HasPrefix(fields[2], "/docker/") ||
|
||||
strings.HasPrefix(fields[2], "/system.slice/docker.service")) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue