I have launched a number of docker containers with node process running inside them. Is there a way to programatically obtain the container ID in which a node process is running during runtime?
Docker version: 17.12.0-ce-mac49
Update: Most most recent attempt hasn't worked:
const cp = require('child_process');
const output = cp.execSync('cat /proc/self/cgroup | grep devices');
console.log(output.toString('utf8'));
But I get the following error:
Error: Command failed: cat /proc/self/cgroup | grep devices
cat: /proc/self/cgroup: No such file or directory
at checkExecSyncError (child_process.js:625:11)
at Object.execSync (child_process.js:662:13)
The same issue is observed when using
cat /etc/hostname