func isContainerizedCgroup()

in providers/linux/container.go [43:56]


func isContainerizedCgroup(data []byte) (bool, error) {
	s := bufio.NewScanner(bytes.NewReader(data))
	for n := 0; s.Scan(); n++ {
		line := s.Bytes()

		// Following a suggestion on Stack Overflow on how to detect
		// being inside a container: https://stackoverflow.com/a/20012536/235203
		if bytes.Contains(line, []byte("docker")) || bytes.Contains(line, []byte(".slice")) || bytes.Contains(line, []byte("lxc")) || bytes.Contains(line, []byte("kubepods")) {
			return true, nil
		}
	}

	return false, s.Err()
}