-
Notifications
You must be signed in to change notification settings - Fork 409
Description
Hi! first of all thanks for the great project.
I encountered a problem when trying to run openssh-server inside a container started with x11docker, and I want to confirm whether this behavior is expected, or whether x11docker can provide an option to support SSH X11 forwarding correctly.
1.Steps to Reproduce
1. Build a minimal test image containing OpenSSH server + Xterm
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y openssh-server xterm xauthdocker build -t ssh-x11-test .This is a minimal environment intended only for verifying whether SSH X11 forwarding works inside an x11docker container.
2.Run the image using x11docker
Run the container with:
x11docker \
--network=bridge \
--name=tc \
--runasroot='mkdir /run/sshd && /usr/sbin/sshd -D \&' \
--runasroot="echo $(logname):1234 | chpasswd" \
-- --privileged -p 8022:22 -- \
ssh-x11-test3. From the host, connect to the container via SSH with X11 forwarding
On the host machine, connect to the container using ssh with password 1234:
ssh -Y -p 8022 USER@CONTAINER_IPonce connected, you can verify environment with command:
echo $DISPLAYInside the SSH session, the DISPLAY variable is like DISPLAY=:120, However, This is the DISPLAY inherited from the x11docker-provided Xorg server inside the container, not the expected forwarded display such as DISPLAY=localhost:10.0
If I try to run Xterm with command xterm, The Xterm window appears inside the container’s Xorg display (the remote desktop), NOT on the external SSH client. Therefore, SSH X11 forwarding is not activated.
2.Closing Notes
I also performed the same tests using the x11docker/xfce image, and the result was identical — SSH X11 forwarding did not activate correctly, and the forwarded display was not created.
It is possible that I misunderstand how SSH X11 forwarding is expected to behave in an x11docker-managed environment, or that this behavior is intentional. If this setup is not supposed to work by design, please let me know.
I am aware that remote graphical access can be achieved through VNC or other methods; my intention here is simply to understand why SSH X11 forwarding does not function as expected inside containers started by x11docker.
Thanks for your time and for maintaining this project.