Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

child_process cant execute docker run

Using simple commands like ls, pwd and even open an external application I have success using child process, but when using exec with a docker command in a built electron app, I get this error:

exec Error: Command failed: docker exec -it 6bec55e9e86e touch home.html
the input device is not a TTY

Here is the code:

var exec = require('child_process').exec;

exec('docker exec -it 6bec55e9e86e touch casa.html', function (error, stdout, stderr) {
  console.log('stdout: ' + stdout);
  console.log('stderr: ' + stderr);
  if (error !== null) {
    console.log('exec error: ' + error);
  }
});
like image 920
calebeaires Avatar asked Jun 13 '26 18:06

calebeaires


1 Answers

please remove -t flag. so you command should be docker exec -i 6bec55e9e86e touch casa.html.

this error the input device is not a TTY mean your input device is not a Teletypes(terminal), and in the commands of docker, -t flag symbols a terminal, so they are conflict. so just remove it.

like image 165
chenkehxx Avatar answered Jun 17 '26 23:06

chenkehxx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!