I need to check is my springboot
is running in a docker
container or not. I am doing it as following. I don't know if .dockerenv
is always on root or not. If it is not correct. How to do it by java?
public static boolean isRunningInsideDocker() {
if(Files.exists(Path.of("/.dockerenv"))){
return true;
}else{
return false;
}
}