jeroenpeeters / docker-ssh

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

cannot connect when using docker-ssh with compose #1

Closed tbeg closed 8 years ago

tbeg commented 8 years ago

The docker run command works just fine! But when I use it with compose (as below) the ssh connection always gets established/authenticated and then closed immediately......

api: build api etc....

ssh: image: jeroenpeeters/docker-ssh volumes:

Am I missing sth obvious? (I'm just starting with docker). If needed I can post ssh -v output here..

Regards, Thomas

jeroenpeeters commented 8 years ago

Can you send me the logs from the docker-ssh container?

dockers logs <your_docker_ssh_container_name>

Couple of things you can check:

  1. The name of your container (double check the name with docker ps)
  2. I'm not sure if bash expansions (like $(which docker)) work with docker compose, I guess not. Make sure you know where the docker binary is located on your machine (do 'which docker' in a shell). Replace $(which docker) in your compose file with the actual path. Most likely it is /usr/bin/docker.

Please let me know how it went!

tbeg commented 8 years ago

Nr. 2 did the trick for me! Replaced $(which docker) with local path and I'm in! It seems docker-compose cannot handle bash expansion like docker does..

Docker-ssh seems great tool in a docker dev environment. I'm aiming at remote debugging in PyCharm using ssh without having to add ssh to the images themselves

Thanks!

jeroenpeeters commented 8 years ago

Great. Cool that you like it.

'without having to add ssh to the images themselves'

This is exactly why I created Docker-SSH. Let me know what you think, I can always use ideas to improve the tool.

tbeg commented 8 years ago

Works great so far!

One little thing; its logging window resize events I could do without in the console

docker logs reacttutorial_ssh_1

docker-ssh@1.0.0 start /usr/src/app ./node_modules/coffee-script/bin/coffee server.coffee

Docker-SSH ~ Because every container should be accessible SSH listening on 0.0.0.0:22 Web listening on http://:::80 NoAuthentication handler is handling the authentication! This is INSECURE! window-change { cols: 154, rows: 11, width: 0, height: 0 } window-change { cols: 154, rows: 15, width: 0, height: 0 } window-change { cols: 154, rows: 17, width: 0, height: 0 } window-change { cols: 154, rows: 15, width: 0, height: 0 } window-change { cols: 154, rows: 11, width: 0, height: 0 } window-change { cols: 154, rows: 4, width: 0, height: 0 } window-change { cols: 154, rows: 7, width: 0, height: 0 } window-change { cols: 154, rows: 14, width: 0, height: 0 } window-change { cols: 154, rows: 20, width: 0, height: 0 } window-change { cols: 154, rows: 21, width: 0, height: 0 } window-change { cols: 154, rows: 17, width: 0, height: 0 } window-change { cols: 154, rows: 14, width: 0, height: 0 } window-change { cols: 154, rows: 13, width: 0, height: 0 } window-change { cols: 154, rows: 12, width: 0, height: 0 } term error Error: read EIO Closing channel Term exit Closing channel Client disconnected Stop Term

Maybe I can get rid of window-change messages myself?

jeroenpeeters commented 8 years ago

well, currently I don't think you can. I'm preparing a newer version in which actually even more will be logged, so you can track what is happening.

Why exactly is this a problem for you? When running the container in the background (as daemon with -d) you shouldn't directly see this unless you check docker logs.

tbeg commented 8 years ago

I'm preparing a python django dev environment for my collegues to work with. I include docker-ssh in the docker-compose.yml just so they don't have to docker run and remember the long commandline version; just ssh user@localhost -p 2222. They will mainly use docker-compose up not up -d to watch the other container logs..In that context I briefly considered the ssh container logs as polluting...I do not any longer. I found docker-compose run --service-ports which is just perfect. I can control django console logs, I can use python pdb debugger AND I trick docker-ssh to start by linking it in docker-compose.yml from the container I start with docker-compose run --service-ports... With that hopefully I can configure remote debugging over ssh in PyCharm.....

With PyCharm ssh/sftp I now encounter an error (Connection to 'localhost' failed. Failed to send channel request). I will create an issue if that error persists