On a new terminal, verify if there's anything running on port 6000 $ lsof -i TCP:6000
Don't forget to close logout and log back in.ĪTTENTION: At this point, make sure to reboot your host (MacOS for instance).Make sure to install XQuartz (Updated with 2021 change) $ brew install socat Docker version docker version 18.06.1-ce.Running version XQuartz 2.7.11 (xorg-server 1.18.4).Went through all the pain to get the simplest version possible that does not depend on checking port, ip, etc. If I change it to 6005, to forward to 6000, and make the Docker container DISPLAY be $(ipconfig getifaddr en0):5 instead, then the connection is of course refused: $ socat TCP-LISTEN:6005,reuseaddr,fork TCP:localhost:6000Ĥ 21:20:32 socat E connect(8, LEN=16 AF=2 127.0.0.1:6000, 16): Connection refusedĭockerized UI Apps in Docker for Desktop MacOS 2018+. It's certainly not port 6000 since that's the port it used to be listening on. But, I don't know what DISPLAY=:0 is connecting to. I can't use the DISPLAY variable that works, either: MacBook-Pro:opencv-gui csaftoiu$ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\":0\"Ĥ 21:09:43 socat E connect(5, LEN=4 AF=1 ":0", 4): No such file or directory Xterm: Xt error: Can't open display: echo $DISPLAYįrom the socat window I get: 4 21:08:15 socat E connect(5, LEN=68 AF=1 "/private/tmp/.3wncZULdXC/:0", 68): Connection refused
Program as a non-root user or by removing the suid bit on the executable. You may get a more descriptive message by running the
BREW CASK INSTALL XQUARTZ NO LAUNCHCTL FULL
The full text of the error or warning message cannot be safely formatted Warning: This program is an suid-root program or is being run by the root user.
BREW CASK INSTALL XQUARTZ NO LAUNCHCTL UPDATE
Running that, from another window I do: MacBook-Pro:opencv-gui csaftoiu$ docker run -rm -it -e DISPLAY=`ipconfig getifaddr en0`:0 ubuntu:14.04 apt-get update & apt-get install xterm In any case, moving on, this socat command does not work: MacBook-Pro:opencv-gui csaftoiu$ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" Question 1: What is XQuartz actually listening on? Xinit: XFree86_VT property unexpectedly has 0 items instead of 1 Note that xinit does work for some reason: $ xinit MacBook-Pro:opencv-gui csaftoiu$ DISPLAY=`ipconfig getifaddr en0`:0 xterm Xterm: Xt error: Can't open display: 127.0.0.1:0 MacBook-Pro:opencv-gui csaftoiu$ DISPLAY=127.0.0.1:0 xterm The following do not work though, not sure why based on the answer here: xterm: Xt error: Can't open display: localhost:0
This value works from a regular OSX too: $ DISPLAY=:0 xterm Srw-rw-rw- 1 csaftoiu wheel 0B May 6 21:12 /private/tmp/.3wncZULdXC/:0 MacBook-Pro:opencv-gui csaftoiu$ ls -alh $DISPLAY The pseudo-file exists, though: MacBook-Pro:opencv-gui csaftoiu$ echo $DISPLAY Xterm: Xt error: Can't open display: /private/tmp/.3wncZULdXC/:0 Testing it out, if I try to open an xterm, it does not work: MacBook-Pro:opencv-gui csaftoiu$ xterm I've installed it via homebrew, via brew cask install xquartz. I believe my question may be answered by just the first part, but just in case (to avoid the XY problem), I've provided the second part as well. I'm attempting to get XQuartz to work on OSX so I can do X11 forwarding via Docker.