The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Rocket.Chat/packages/rocketchat-lib/server/functions/isDocker.js

31 lines
488 B

import fs from 'fs';
function hasDockerEnv() {
try {
fs.statSync('/.dockerenv');
return true;
} catch (err) {
return false;
}
}
function hasDockerCGroup() {
try {
return fs.readFileSync('/proc/self/cgroup', 'utf8').indexOf('docker') !== -1;
} catch (err) {
return false;
}
}
function check() {
return hasDockerEnv() || hasDockerCGroup();
}
let isDocker;
RocketChat.isDocker = function() {
if (isDocker === undefined) {
isDocker = check();
}
return isDocker;
};