- Install XQuartz: https://www.xquartz.org/
- Launch XQuartz. Under the XQuartz menu, select Preferences
- Go to the security tab and ensure "Allow connections from network clients" is checked.
- Run
xhost + ${hostname}
to allow connections to the macOS host * - Setup a HOSTNAME env var
export HOSTNAME=`hostname`
* - Add the following to your docker-compose:
environment:
- DISPLAY=${HOSTNAME}:0
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
* It should be noted that steps 4 and 5 can be automated to run everytime XQuartz starts, but that's outside of the scope of this gist
Adding a note of encouragement and thanks - I got my display working because of the instructions here.
FYI my setup - M1 MacBook Pro. So I'm using Rancher Desktop with a VM setup/dockerd.
Both of these worked for me getting a (gtk-based) x application runing inside an xterm inside XQuartz. fwiw I'm compiling the latests emacs (29.0) which has GTK support.
And also