I have used these instructions for Running Gui Apps with Docker to create images that allow me to launch GUI based applications.
It all works flawlessly when running Docker on the same machine, but it stops working when running it on a remote host.
Locally, I can run
docker --rm --ti -e DISPLAY -e <X tmp> <image_name> xclock
And I can get xclock
running on my host machine.
When connecting remotely to a host with XForwarding
, I am able to run X applications that show up on my local X Server, as anyone would expect.
However if in the remote host I try to run the above docker command, it fails to connect to the DISPLAY
(usually localhost:10.0
)
I think the problem is that the XForwarding
is setup on the localhost interface of the remote host.
So the docker host has no way to connect to DISPLAY=localhost:10.0
because that localhost means the remote host, unreachable from docker itself.
Can anyone suggest an elegant way to solve this?
Regards Alessandro
EDIT1:
One possible way I guess is to use socat
to forward the remote /tmp/.X11-unix
to the local machine. This way I would not need to use port forwarding.
It also looks like openssh
6.7 will natively support unix socket forwarding.