X11 forwarding issues with release 10

Expected behavior

Installed and running XQuartz, was working in prior release (beta 8)
used to export the bridge device IP for X forward display

$export XDISPLAY=$(ifconfig bridge100 | grep "inet " | cut -d " " -f2):0

now no longer a bridge100, switched to en0

$export XDISPLAY=$(ifconfig en0 | grep "inet " | cut -d " " -f2):0

$ docker run -d --name firefox -e DISPLAY=$XDISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox
77ec618eebc7a73a9209bd39ef62a54443879553f2d3326dcf0cbebac8cb2f78

$ docker logs 77ec

(firefox:1): Gtk-WARNING **: Locale not supported by C library.
Using the fallback ‘C’ locale.

Actual behavior

Runs but does not forward display for firefox

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
77ec618eebc7 jess/firefox “/usr/bin/firefox” 52 seconds ago Up 50 seconds firefox

Information

  • the output of:

    • pinata diagnose -u on OSX
      MacBook-Air:~ bgrissin$ pinata diagnose -u
      OS X: version 10.11.4 (build: 15E65)
      Docker.app: version v1.11.1-beta10
      Running diagnostic tests:
      [OK] docker-cli
      [OK] Moby booted
      [OK] driver.amd64-linux
      [OK] vmnetd
      [OK] osxfs
      [OK] db
      [OK] slirp
      [OK] menubar
      [OK] environment
      [OK] Docker
      [OK] VT-x
      Docker logs are being collected into /tmp/20160506-100054.tar.gz
      Most specific failure is: No error was detected
      Your unique id is: BC837A9A-C184-44E1-B9FF-86C941DB7E5A
  • Darwin MacBook-Air.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

Steps to reproduce the behavior

1 Like

I think bridge100 is still supposed to exist and it is a bug if it doesn’t. Is that not true? Why do you think en0 will work? bridge100 last showed up for me in beta 8 as well.

$ pinata diagnose -u
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta10
Running diagnostic tests:
[OK]      docker-cli
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160507-100945.tar.gz
Most specific failure is: No error was detected
Your unique id is: 910FA6B2-06DD-43F4-B7DA-3E6AF4A619FE
Please quote this in all correspondence.

Apparently bridge100 doesn’t exist anymore and you the ports will be directly exposed on localhost. For X11, perhaps just export DISPLAY=:0 and expose port 6000 with -p 6000:6000.

see Bridge100 bridge unavailable on host

Thanks to @ctaggart I’ve been able to get this to work in beta11.
(Cameron’s blog: http://blog.ctaggart.com/2016/03/gnu-octave-via-docker-x11.html?m=1)

The dummy’s step-by-step quide:

  1. Run XQuartz
    a. Update preferences ‘Security’ tab - turn on 'Allow connection from network clients’
    b. Restart XQuartz and then check to see that it is listening on port 6000:
    lsof -i :6000

  2. Get your local machine’s IP:
    ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') && echo "My IP is: $ip"

  3. Allow the local machine to talk to XQuartz
    xhost + ${ip}

  4. Run your docker host:
    docker run -d --name firefox -e DISPLAY=${ip}:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox

So, once the steps #1-3 are run then #4 is good to go for any container.

5 Likes

How did you get this working ?

When Xquartz runs it opens a socket, it is not listening on a port.

Are you running socat to do port forwarding from port 6000 to socket ?
e.g.
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:"$DISPLAY" &

Indeed the socket is somehow pre-opened on OS X even if xQuartz is not running, I believe this is done that way so that as soon as an application try to use X11, Quartz is started.

I have Quartz up and running and lost -i :6000 shows no one is listening on port 6000.
of course if I start socat as in my example then lost find that scout is listening.

However I expect docker for mac to works like dock on linux in that aspect of X11 forwarding.

I mean
docker run -it -v /private/tmp/com.apple.launchd.hF6VPfurBa/org.macosforge.xquartz:0:/tmp/.X11-unix/X0 ubuntu
or even better
docker run -it -v ${DISPLAY}:/tmp/.X11-unix/X0 ubuntu
as DISPLAY is set.

should allow the docker container to access the display as it is done with ubuntu with such command
docker run -it -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 ubuntu

however
docker run -it -v ${DISPLAY}:/tmp/.X11-unix/X0 ubuntu on OS X gives this error
invalid mode: /tmp/.X11-unix/X0.

I suspect the : in the DISPLAY variable to disturb the docker daemon parsing.
I tried to escape it with a \ or to put all between got with no success and the same error

I was using the current Quartz version 2.7.9 and had exactly the same problem as you. The cause was the Quartz version. See bug 95379.

However, the good news is, that it works with Quartz 2.7.10_beta2 as @v4tech described above. I’m using Docker for Mac 1.12.0-rc3-beta18.