diff --git a/system/host.go b/system/host.go index a13142a..587f228 100644 --- a/system/host.go +++ b/system/host.go @@ -1,6 +1,7 @@ package system import ( + "bufio" "context" "fmt" "os" @@ -125,6 +126,16 @@ func getHostInfo() (string, string, string, string, string, string, string, stri if os.IsExist(err) { VmType = "Docker" } + cgroupFile, err := os.Open("/proc/1/cgroup") + defer cgroupFile.Close() + if err == nil { + scanner := bufio.NewScanner(cgroupFile) + for scanner.Scan() { + if strings.Contains(scanner.Text(), "docker") { + VmType = "Docker" + } + } + } _, err = os.Stat("/dev/lxss") if os.IsExist(err) { VmType = "Windows Subsystem for Linux"