I am trying to run a docker container using dockerode following the examples here.
The issue I am having is that the output of the container prints to stdout, but I am trying to capture it and store it in a variable while using promises if possible.
My code is:
const Docker = require('dockerode');
const docker = new Docker();
docker
.run(
'wappalyzer/cli',
['https://www.wappalyzer.com'],
[process.stdout, process.stderr],
{ Tty: false }
)
.then((data) => {
let output = data[0];
let container = data[1];
console.log(typeof output);
console.log(output);
return container.remove();
})
.catch((error) => console.log(error));