AllowUstoGetContainerInfoOnDocker
Tested on docker. Although "/proc/self/cgroup" file is not empty, "/proc/self/cgroup".toFile().length() returns 0 as does Files.size("/proc/self/cgroup").
This commit is contained in:
parent
307e56714e
commit
ce0d09f04a
|
@ -66,12 +66,15 @@ public class ContainerInfo {
|
|||
}
|
||||
|
||||
public static boolean isRunningInContainer() {
|
||||
return Files.isReadable(CGROUP_DEFAULT_PROCFILE)
|
||||
&& CGROUP_DEFAULT_PROCFILE.toFile().length() > 0;
|
||||
return Files.isReadable(CGROUP_DEFAULT_PROCFILE);
|
||||
}
|
||||
|
||||
public static ContainerInfo fromDefaultProcFile() throws IOException, ParseException {
|
||||
final String content = new String(Files.readAllBytes(CGROUP_DEFAULT_PROCFILE));
|
||||
if (content.isEmpty()) {
|
||||
log.error("proc file is empty");
|
||||
throw new IOException();
|
||||
}
|
||||
return parse(content);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue