
Debugging steps can be checked from the link above.

NB: If all of the above steps were completed successfully, an X window should open on your host which is forwarding from the container.

You can also set the env var directly in the container with bash/Dockerfile/etc. This will get X within the container to connect to port 6000 on your host and communicate with XQuartz - the volume mount is entirely unused. NB: is the DNS name which resolves to your host machine from within your docker container. Pass -e DISPLAY=:0 to any docker image you want to forward X to the host.Also if XQuartz is not running, xhost will start it. NB: This will allow network X11 connections from localhost only, which is fine. In a terminal on the host, run xhost +localhost.The volume mount is not (and cannot due to an ongoing issue - more details in the original link) be used. This is actually how your docker container will be communicating with XQuartz on the host. NB: After restarting XQuartz, you can run netstat -an | grep -F 6000 to find that XQuartz has opened port 6000. From the XQuartz preferences, in the security tab, make sure Allow connections from network clients is enabled.

It also helped me understand why the volume mount doesn't do anything and what's really going on. this link contains the only correctly current version. It seems things have moved a bit underneath all this since 2017, so I created an updated version.įor anyone arriving. Thanks for this, it really helped me out!
