我启动了许多带有节点进程的docker容器。是否有办法以编程方式获取运行时在其中运行节点进程的容器ID?
Docker版本:17.12.0-ce-mac49
更新: 最近的尝试无效:
const cp = require('child_process');
const output = cp.execSync('cat /proc/self/cgroup | grep devices');
console.log(output.toString('utf8'));
但是出现以下错误:
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)
使用时观察到相同的问题
cat /etc/hostname