Dockerode: docker.run output result start with an unknow character, then use docker.modem.followProgress error occurred "Error: Unexpected "\u0000" at position 1 in state START"

Created on 18 Jun 2016  路  3Comments  路  Source: apocas/dockerode

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:
2016-06-18 13 56 04

docker.modem.followProgress error output:
2016-06-18 13 56 47

Do you know how to resolve it?

question

Most helpful comment

+1 for no document about this

All 3 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tkarls picture tkarls  路  6Comments

florentvaldelievre picture florentvaldelievre  路  4Comments

knight42 picture knight42  路  7Comments

hackhat picture hackhat  路  4Comments

gaetsd picture gaetsd  路  3Comments