Unable to use wetty Docker container to connect to an ssh Docker container
See original GitHub issueDescribe the bug I’m unable to use the wetty web shell to connect to another Docker container that I’ve spun up to serve as an SSH server. I’ve confirmed that I can connect to the Docker container via SSH using my host, but I’m unable to access it via the wetty Docker container/web shell.
To Reproduce Steps to reproduce the behavior:
- I have the following
Dockerfile
:
FROM ubuntu:latest
RUN apt update && apt install openssh-server sudo -y
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 test
RUN echo 'test:test' | chpasswd
RUN service ssh start
EXPOSE 22
CMD ["/usr/sbin/sshd","-D"]
-
Build the ssh Docker container with
docker build -f Dockerfile -t ssh-test .
and run usingdocker run -it -p 22:22 ssh-test
-
Verify that you can connect to the container via ssh (by trying to connect via ssh from the host to the container):
(base) andrew@Andrews-MacBook-Pro webshell % ssh test@localhost
test@localhost's password:
Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.10.76-linuxkit x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, you can run the 'unminimize' command.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
test@d6858280da2a:~$
-
Now spin up the wetty container
docker run --rm -p 3000:3000 wettyoss/wetty --ssh-host=127.0.0.1 --ssh-port=22
-
Now access the wetty terminal at
localhost:3000
, and insert thetest
username andtest
password. -
I get an incorrect login via wetty but I’ve confirmed that I’m able to ssh into the
ssh-test
Docker container from my host.
Expected behavior
I would expect that I can access the ssh-test
container via SSH using the wetty web shell.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: macOS
- Browser Chrome
- Version 100.0.4896.127
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top GitHub Comments
🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏
Yes it can be confusing, as
localhost
is not always “localhost” 😂 (you’re definitely not the first one getting confused!)Glad this helped 👍