- 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
The latest version of "DrSnowbird/jdk-mvn-py3-x11" already automatically" set up everything for you.
The latest version will automatically do all the necessary X11 setup for you except "the installation of xquartz" (running the 'run.sh' will automatically launch XQuartz).
So, you don't have do anything to run X11 on your host machine regardless macOS, Ubuntu, or CentOS (due to the automation inside run.sh). It is just as simple as below since "run.sh" script automatically does everything for you.
Bonus,
That's it!
Important: You don't have to do anything setup including xhost, HOSTNAME, etc. It is all automatically done in "run.sh"
PS: if you are still having trouble, my recommendation is to use "noVNC" using your web HTML 5 browsers to run as your desktop. You can access your Docker Container's desktop using any HTML 5 web browser. Please see:
https://github.com/DrSnowbird/jdk-mvn-py3-vnc.git
best, cheers!
DS.