I run the following code in my app:
const command = 'sudo chown user:user /home/user/.ssh/authorized_keys';
const container = docker.getContainer(containerId);
const options = {
Cmd: [ '/bin/bash', '-c', command ],
AttachStdout: true,
AttachStderr: true
};
container.exec(options, (error, exec) => {
if (error) {
callback(error);
return;
}
exec.start((error, stream) => {
callback(error, stream);
});
});
With dockerode v2.4.3 it works fine, but with dockerode 2.5.0 my callback receives this error:
{ Error: (HTTP code 500) container not running - {"message":"EOF"}
at /home/janx/janitor/node_modules/docker-modem/lib/modem.js:243:17
at IncomingMessage.<anonymous> (/home/janx/janitor/node_modules/docker-modem/lib/modem.js:270:9)
at emitNone (events.js:110:20)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1047:12)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
at process._tickCallback (internal/process/next_tick.js:161:9) reason: 'container not running', statusCode: 500, json: null }
Note, this happens with two Docker instances running versions 17.05.0-ce and 1.12.6.
Edit: With 2.4.3, the chown user:user is successfully applied, but with 2.5.0 the targeted file remains root:root.
A workaround is attaching to stdin (it works when you send the options needed to attach to stdin), check the issue bellow there is an example there.
It was caused by:
https://github.com/apocas/docker-modem/issues/81
We are still trying to find why docker behaves like that when you don't attach to stdin.
Same problem here back to v2.4.3 and work fine :)
We're still pinned on v2.4.3 because of this issue :) not a huge problem though
Just published v2.5.1 that should fix this.
I confirm that v2.5.1 doesn't seem to have this problem anymore. Thanks a lot for the fix!
Most helpful comment
Just published v2.5.1 that should fix this.