Docker: running application with a remote X-server

I currently run my application in a container together with Xvfb and X11VNC. This all works nicely and I can see the GUI via any VNC client.
However, I would like to run Xvfb and X11VNC in container A, and my application in container B.

Container A is started as e.g.
docker run -it –rm –name x11 -p 6000-6100:6000-6100 myimagewithXvfb

  • Profiling a C# dot net application running on a docker container
  • Travis CI — Docker run shell to extra Values
  • Isolated and Reproducible Development Environment (X Forwarding + Docker)
  • How to update docker in aws ec2
  • Docker compose - share volume Nginx
  • docker share folder from container to host system
  • In B I set to DISPLAY=A, to point to the X server (XVfb) in container A.

    In B I start e.g. xeyes, but I get the error:
    root@a1ec4b67e98f:/# xeyes
    Error: Can’t open display: 10.1.0.1
    root@a1ec4b67e98f:/# echo $DISPLAY
    10.1.0.1

    Also using 10.1.0.1:0 does not matter.

    Anyway, the question is how to get this to work, if possible at all ?

  • Docker build: unable to fetch archives
  • mongod doesn't stop (docker debian:wheezy)
  • Opening a (Bluemix) container to all incoming connection
  • Dockerize Multi Module Maven Project
  • Mounting local directory into Docker container path that is not exposed as a VOLUME
  • fs.readFile Behaving Differently Inside Docker Container
  • One Solution collect form web for “Docker: running application with a remote X-server”

    Without more information it’s hard to tell for sure, but my guess is that your problem is related to X authority. You can either allow clients to connect without access control by using the xhost command:

    A> xhost +
    B> export DISPLAY=10.1.0.1:0
    B> xeyes
    

    A more secure way is on container A ssh to container B like this:

    A> ssh -Y B
    B> xeyes
    

    (Here you don’t need to manually set the DISPLAY env. variable as it’s set by SSH automatically.)

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.