X11 in docker on macOS
x11_docker_mac.md#
### To forward X11 from inside a docker container to a host running macOS
1. Install XQuartz: https://www.xquartz.org/
2. Launch XQuartz. Under the XQuartz menu, select Preferences
3. Go to the security tab and ensure "Allow connections from network clients" is checked.
4. Run `xhost + ${hostname}` to allow connections to the macOS host *
5. Setup a HOSTNAME env var `` export HOSTNAME=`hostname` ``*
6. Add the following to your docker-compose:environment:
- DISPLAY=${HOSTNAME}:0 volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
<sub>* 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</sub>