From 0837889762a549f52ad1ae5f3f34e7188b667653 Mon Sep 17 00:00:00 2001 From: mpl Date: Tue, 14 Nov 2017 17:44:32 +0100 Subject: [PATCH] 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 --- clients/android/build-in-docker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clients/android/build-in-docker.go b/clients/android/build-in-docker.go index 70eef00d9..6f1aa4712 100755 --- a/clients/android/build-in-docker.go +++ b/clients/android/build-in-docker.go @@ -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 } }