How to get GUIs to open on Windows 10 when running an Ubuntu container through ssh

I am trying to run a GUI from inside an Ubuntu container through a ssh connection manager to my Windows 10 machine and none of the solutions I’ve found so far solve the issue for me. As an example, I’d like to get Firefox to open in a new window on my machine when I run it in a container on a remote server. The steps are:

  • Connect to remote server through MobaXterm ssh session. X11 forwarding is set, and the home screen says that the DISPLAY variable has been set to DISPLAY=xxx.xxx.x.xx:1.0.
  • On the remote server, build a test image from a Dockerfile:
   FROM ubuntu:latest
   RUN apt-get update && apt-get install -y firefox
   CMD /bin/bash
   $> docker build -t firefox-test .
  • Run the container on the server and set the display variable to the MobaXterm address:
   docker run -it --rm -e DISPLAY=xxx.xxx.x.xx:1.0 firefox-test
   [email protected]: firefox &

I immediately get what I think is a confirmation that it will work:

   [1] 11

but then after a while I get the error

   [email protected]: Unable to init server: Broadway display type not supported: xxx.xxx.x.xx:1.0
   Error: cannot open display: xxx.xxx.x.xx:1.0

I have tried many variations on docker run options, such as -v /tmp/.X11-unix:/tmp/.X11-unix and/or --net host, but nothing gives me anything other than an error like the one above.

Using Firefox is only a test case, as I ideally want to be able to run NVIDIA’s Nsight GUI within an nvidia/cuda:10.1-base container. So far everything with this setup seems to work, but I’m getting the same kind of display errors when I try to run Nsight within the container.

Please let me know if there are additional logs or info that might be useful.

Source: StackOverflow