How to Display GUI on Xming from a docker container

  • I have Xming running on Windows 10
  • I ssh with x-forwarding into a Linux host
  • Running an X-app on the host displays on Xming
  • I run a docker container and I can not run an X-app in the container and get the following error:
    woodbri@cde8378da215:~$ display
    display: unable to open X server `localhost:13.0’ @ error/display.c/DisplayImageCommand/426.

I run docker like this:
sudo docker run -it
–user=$(id -u)
–env=“DISPLAY”
–workdir="/home/$USER"
–volume="/home/$USER:/home/$USER"
–volume="/etc/group:/etc/group:ro"
–volume="/etc/passwd:/etc/passwd:ro"
–volume="/etc/shadow:/etc/shadow:ro"
–volume="/etc/sudoers.d:/etc/sudoers.d:ro"
–volume="/tmp/.X11-unix:/tmp/.X11-unix:rw"
–volume="/u:/u:rw"
my_process
If I start the container using --net=host then I can connect, but this does not seem to be a safe option to use.

DISPLAY=localhost:13.0

How do I tell docker to send X11 stuff through the ssh X-forwarded connection on the host?

2 Likes