Closed asperling closed 8 years ago
Hi, I tried the steps mentioned in your issue report, but when I execute these steps I can actually ssh into the container. I see in the output of the webinterface you posted that you are trying to ssh into a container named 'php-debug-test2' while the container in your example is called 'sshd-less '.
Are you sure that container 'php-debug-test2' has bash? This is problem can actually manifest if bash is not present, or not present on the PATH.
By default Docker-SSH tries to start a shell with the bash
command. If your container has bash on a different path, or uses a different shell (for example sh
) you can configure Docker-SSH to use that shell by specifying the CONTAINER_SHELL environment variable like so:
docker run -e CONTAINER_SHELL=/bin/sh -e CONTAINER=sshd-less -e AUTH_MECHANISM=noAuth \ --name sshd-php-debug-test -p 2222:22 -p 8022:8022 --rm \ -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker \ jeroenpeeters/docker-ssh
First try the following to check if the container has bash or sh.
docker exec -ti sshd-less which bash
or docker exec -ti sshd-less which sh
Let me know how it goes.
Hey, thanks for the lightning fast reply!
And yes, there were typos. I wanted to clean up my naming mess with things like "test2" and such but it didn't work out, did it? :)
Yes, the container has bash, verified by:
> docker exec -ti php-debug-test2 which bash
/bin/bash
But still no luck. It the same as described above. I also made sure only those two containers were running.
As of the moment I can only think of one and that's a problem with mounting the docker socket and binary and some/one missing dependencies on the guest.
After exec'ing into the docker-ssh container and trying to exec into my ssh-less conatainer I get the following error:
root@bd6d89f564a2:/lib/x86_64-linux-gnu# docker exec -ti nostalgic_meitner sh
docker: /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1: version `DM_1_02_97' not found (required by docker)
(nostalgic_meitner in that case is a running alpine conatiner)
The same error occurs by just calling docker
from inside the running docker-ssh container.
Now, my docker env is as dfollows:
> docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:20:08 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:20:08 UTC 2015
OS/Arch: linux/amd64
Well, I fixed it or more precisely found a workaround by mounting the library into the docker-ssh container alongside the docker socket and binary which results in the following run statement:
docker run \
-e CONTAINER_SHELL=sh \
-e CONTAINER=nostalgic_meitner \
-e AUTH_MECHANISM=noAuth \
--name sshd-docker \
-p 2222:22 \
-p 8022:8022 \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker \
-v /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1:/lib/x86_64-linux-gnu/libdevmapper.so.1.02.1 \
jeroenpeeters/docker-ssh
Now it works like a charm and I will close this issue!
As an improvement I would suggest using a docker-in-docker container instead of mounting the executable and socket (and now the device mapper lib). Maybe I will give it a try.
Could you please pull the latest version and try it without mapping libdevmapper. I changed the image to be based on Alpine with all the Docker binaries/libraries included. The image itself is also much smaller. For me it is now enough to only map the docker socket into the container.
Please give it a try and let me know how it went.
My request is still current, however I have completely removed all Docker binaries from the image. I changed the implementation to directly connect to the Docker engine using the API over the Docker socket. There is no need to map any binaries anymore except for the Docker socket.
Hey, I'm back from some vacation days... I'll give it a try asap. BTW I also tried to build an image based on alpine, added glibc and stuff but it wouldn't work. So I'm curious!
Did you manage to try it again?
This looks really promising but I just can't get it to work. Even if I more or less c&p your example:
Start something to ssh into later.
Start the docker-ssh container:
The webinterface only gives me:
Nothing like in your screenshot. Then trying to connect via
ssh root@localhost -p 2222
results in the following:Any idea? I'd be really interested in a minimal working example. Does the container I'd like to ssh into have to provide anything?