jeroenpeeters / docker-ssh

SSH Server for Docker containers ~ Because every container should be accessible
GNU General Public License v2.0
638 stars 89 forks source link

docker for mac (?) issue #21

Closed matti closed 7 years ago

matti commented 7 years ago
$ docker run -d --name alpine alpine:3.4 top
$ docker run -it -p 2222:22 -p 9999:8022 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e CONTAINER=alpine -e AUTH_MECHANISM=noAuth \
jeroenpeeters/docker-ssh
[2016-11-24T19:14:22.497Z]  INFO: webserver/64 on 30b08b7d3697: Listening (host=::, port=8022)
[2016-11-24T19:14:22.500Z]  INFO: sshServer/64 on 30b08b7d3697: Docker-SSH ~ Because every container should be accessible
[2016-11-24T19:14:22.501Z]  INFO: sshServer/64 on 30b08b7d3697: Listening (host=0.0.0.0, port=22)
[2016-11-24T19:15:06.021Z]  INFO: sshServer/64 on 30b08b7d3697: Client connected (clientIp=172.17.0.1)
[2016-11-24T19:15:06.099Z] ERROR: noAuthHandler/64 on 30b08b7d3697: NoAuthentication handler is handling the authentication! This is INSECURE!
[2016-11-24T19:15:06.184Z]  INFO: sessionHandler/64 on 30b08b7d3697: Opening shell (container=alpine)
[2016-11-24T19:15:06.332Z]  INFO: sessionHandler/64 on 30b08b7d3697: Terminal exited (container=alpine)
[2016-11-24T19:15:06.340Z]  INFO: sessionHandler/64 on 30b08b7d3697: Channel exited (container=alpine)
[2016-11-24T19:15:06.341Z]  INFO: sshServer/64 on 30b08b7d3697: Client disconnected (clientIp=172.17.0.1)
/src/src/session-handler-factory.coffee:156
                  stream.on('data', function(data) {
                        ^

TypeError: Cannot read property 'on' of null
  at Object.callback (/src/src/session-handler-factory.coffee:79:19)
  at /src/node_modules/dockerode/lib/exec.js:39:10
  at Modem.buildPayload (/src/node_modules/docker-modem/lib/modem.js:225:19)
  at ClientRequest.<anonymous> (/src/node_modules/docker-modem/lib/modem.js:210:10)
  at emitOne (events.js:96:13)
  at ClientRequest.emit (events.js:188:7)
  at writeAfterEndNT (_http_outgoing.js:486:8)
  at _combinedTickCallback (internal/process/next_tick.js:77:11)
  at process._tickCallback (internal/process/next_tick.js:98:9)

error: Forever detected script exited with code: 1
error: Script restart attempt #5
[2016-11-24T19:15:07.413Z]  INFO: webserver/70 on 30b08b7d3697: Listening (host=::, port=8022)
[2016-11-24T19:15:07.415Z]  INFO: sshServer/70 on 30b08b7d3697: Docker-SSH ~ Because every container should be accessible
[2016-11-24T19:15:07.416Z]  INFO: sshServer/70 on 30b08b7d3697: Listening (host=0.0.0.0, port=22)
matti commented 7 years ago

Looks like related to https://github.com/jeroenpeeters/docker-ssh/issues/11

jeroenpeeters commented 7 years ago

Please check if the container has bash installed. By default docker-ssh tries to start a bash shell. Please see the docs on how to override this. Maybe you should go for sh

matti commented 7 years ago

That's it. I just read docs briefly and the README says "The container has a shell environment installed (e.g. bash or sh)."

So I assumed that it would fallback. Maybe it should fallback (another issue on that?)

jeroenpeeters commented 7 years ago

Indeed, please create an issue for that. Also, the error reporting can be greatly improved.