I created a micro-service using the "Moleculer" framework. I used child_process.exec for running docker commands in a shell. I get "/bin/sh: 1: docker: not found" error.
const { exec } = require("child_process");
.
.
.
exec("docker --version", (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
});
Tried giving absolute path as:
exec("/usr/bin/docker --version", (err...);
But still got the same error.
I am able to get the node version using:
exec("node --version", (err...);