You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found an interesting situation that i was able to track down a bit. I am unsure if this is a bug with docker-modem or potentially how Docker for Windows sets up the named pipe to begin with.
Here is a file to reproduce (uses latest node-docker-api but upgraded to docker-modem 1.0.0), the same thing happens if you use analogous code for dockerode
'use strict'constDocker=require('node-docker-api').DockerconstpromisifyStream=(stream)=>newPromise((resolve,reject)=>{stream.on('data',(d)=>console.log(d.toString()))stream.on('end',()=>{if(process.stdin.setRawMode){process.stdin.setRawMode(false);}process.stdin.pause();resolve()})stream.on('error',reject)})varthingconstdocker=newDocker({socketPath: '//./pipe/docker_engine'})//const docker = new Docker({host: '127.0.0.1', port: 2375})let_containerdocker.container.create({Image: 'debian:jessie',Cmd: ['/bin/bash','-c','tail -f /var/log/dmesg']}).then((container)=>container.start()).then((container)=>{_container=containerreturncontainer.exec.create({AttachStdin: true,AttachStdout: true,AttachStderr: true,Cmd: ['echo','thing'],Tty: true})}).then((exec)=>{returnexec.start({hijack: false,Detach: false,Tty: true,stdin: true,})}).then((stream)=>{thing=stream}).then(()=>{thing.pipe(process.stdout);// Restart stdin with correct encodingprocess.stdin.resume();process.stdin.setEncoding('utf8');// Make sure rawMode matches upif(process.stdin.setRawMode){process.stdin.setRawMode(true);}// Send our processes stdin into the containerprocess.stdin.pipe(thing);}).then(()=>promisifyStream(thing)).then(()=>_container.delete({force: true})).catch((error)=>console.log(error))
If you connect over tcp (need to allow insecure connections in the docker for windows app first), it works as expected but if you switch over to the named pipe it will hang after "thing" is written to stdout. What is extremely interesting is after this happens you can get the stream to close and the process to resume by pressing any key three times.
Hi, I'm most likely running in to the same problem with Dockerode 2.5.4 which relies on Docker-modem 1.0.4 . Anything with exec.start gets stuck and won't terminate properly.
Found an interesting situation that i was able to track down a bit. I am unsure if this is a bug with docker-modem or potentially how Docker for Windows sets up the named pipe to begin with.
Here is a file to reproduce (uses latest
node-docker-api
but upgraded todocker-modem 1.0.0
), the same thing happens if you use analogous code fordockerode
If you connect over
tcp
(need to allow insecure connections in the docker for windows app first), it works as expected but if you switch over to thenamed pipe
it will hang after "thing" is written tostdout
. What is extremely interesting is after this happens you can get the stream to close and the process to resume by pressing any key three times.Another interesting data point here is it looks like
docker-compose
itself avoids using the API for this on Windows, deciding to just delegate directly to a shell call todocker exec
.see: https://github.com/docker/compose/blob/master/compose/cli/main.py#L411
My best guesses at this point are:
Any thoughts about why this could be happening?
The text was updated successfully, but these errors were encountered: