NodeJS spawned docker process hangs
I have the following code, that spawns a docker process upon entering a
path. However, the docker does not close, the callback is never called. I
write the exact result onto a shell and it works perfectly. It doesn't
matter if I use exec or spawn, the behavior is same.
app.get("/path", function(req,res){
// docker run -v $1/:folder mustafa/java /bin/bash folder/execute.sh
var args = ["run","-v " + submission.path + ":/folder",
"mustafa/java", "/bin/bash folder/execute.sh"];
console.log(args.join(" "));
exec('docker ' + args.join(" "), function (error, stdout, stderr) {
console.log("here");
console.log(stdout);
console.log(stderr);
res.send("something");
res.end();
});
});