I am developing lib for the docker command line in nodejs, I am still at the beginning, I just tried running the docker command with spawn in node js - everything works fine, but it doesnβt work for complex cases like the one below.
I want to run docker run --rm -it julia:0.3.6 julia -E "[x^2 for x in 1:100]"in nodejs, but I get below errors -
input device is not TTY
Docker Shell existed with status = 1
Below code is
const
spawn = require('child_process').spawn,
dockerDeamon = spawn("docker", ["run","--rm", "-it", "julia:0.3.6", "-E", "\" [x^2 for x in 1:100]\""] );
dockerDeamon.stdout.on('data', data => {
console.log(`${data}`);
});
dockerDeamon.stderr.on('data', data => {
console.log(`${data}`);
});
dockerDeamon.on('close', code => {
console.log(`Docker Shell existed with status = ${code}`);
});
Is there a better way to execute the script described above?
source
share