0

I'm a bit stuck. There are lots of posts how to expose your host display to docker containers. None of them seems to work for me or I'm doing something wrong.

The situation is as follows:

I have a host linux machine H which is running a docker container C. The host machine H doesn't have x-server. I'm starting a new terminal window on my desktop machine D and type:

desktop_D:> ssh -X machine_H
machine_H:> export XAUTH=/tmp/.docker.xauth
machine_H:> xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
machine_H:> docker run -it -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $XAUTH:$XAUTH -e XAUTHORITY=$XAUTH opensuse-image /bin/bash
inside_docker:> xterm
xterm: Xt error: Can't open display: localhost:16.0

If i'm running docker on my desktop machine - everything works fine. I guess something is not right when passing display to docker. Any help would be appreciated!

P.S. I guess an approach with having a SSH server running in the container should change something - but that's ugly.

novak Li
  • 183
  • 2
  • 11
  • 1
    `ssh` usually doesn't create a local unix domain socket for X11 forwards but a tcp socket that listens on the loopback interface only, for `:16` it would be on port 6016. You'd probably need to change your [sshd config](http://man.openbsd.org/sshd_config) to disable X11UseLocalhost so you can [connect to that port from within the container](http://stackoverflow.com/questions/31324981) and change the host part of `$DISPLAY` to the `docker0` ip address ([unless you're using host networking mode](http://stackoverflow.com/questions/24319662)) – mata Feb 28 '17 at 16:13
  • xterm needs an X server. Do you have one (Xorg, Xvfb, xpra, ...) in your container? Or do you want to use X from desktop machine D? – mviereck Mar 03 '17 at 00:50
  • @mviereck Yes I want to use one from machine D – novak Li Mar 03 '17 at 11:54
  • @mata yes you're right. Disabling X11UseLocalhost does the trick. – novak Li Mar 03 '17 at 11:55

0 Answers0