Giter Site home page Giter Site logo

Comments (8)

jeroenpeeters avatar jeroenpeeters commented on August 20, 2024

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.

from docker-ssh.

asperling avatar asperling commented on August 20, 2024

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.

from docker-ssh.

asperling avatar asperling commented on August 20, 2024

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

from docker-ssh.

asperling avatar asperling commented on August 20, 2024

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.

from docker-ssh.

jeroenpeeters avatar jeroenpeeters commented on August 20, 2024

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.

from docker-ssh.

jeroenpeeters avatar jeroenpeeters commented on August 20, 2024

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.

from docker-ssh.

asperling avatar asperling commented on August 20, 2024

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!

from docker-ssh.

jeroenpeeters avatar jeroenpeeters commented on August 20, 2024

Did you manage to try it again?

from docker-ssh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.