Hi, apocas
My purpose is catch the process.stdout and return to the browser client side
the code:
var cmd = ['php', '--version'];
docker.run('ubuntu:0.3.0', cmd, process.stdout, {
WorkingDir: '/code',
Tty: false
}, {
'Binds': [__dirname + '/../temp:/code']
}, function (err, data, container) {
}).on('stream', function (stream) {
stream.pipe(process.stdout);
docker.modem.followProgress(stream, function onFinished(err, output) {
console.log(err, output); // output is an Array
});
});
Ubuntu terminal output:

docker.modem.followProgress error output:

Do you know how to resolve it?
Now I add one line Env: ['LANG=C.UTF-8', 'LANGUAGE=C.UTF-8', 'LC_ALL=C.UTF-8'] in docker.run create options, but it's useless
Those are Docker stream control bytes. You need to demux the stream.
Check this example: https://github.com/apocas/dockerode/blob/master/examples/exec_running_container.js#L24
And probably exec is way better for your use case than run :)
+1 for no document about this
Most helpful comment
+1 for no document about this