A quick guide on how to run docker containers requiring a GUI with Mac and XQuartz. First, you’ll need to download and install XQuartz. Run it.
Now, start socat to expose local xquartz socket on a TCP port:
$ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
Pass the display to container :
docker run -e DISPLAY=192.168.99.1:0 pygame xclock
I’m assuming that 192.168.99.1 is your vboxnet IP address and that «pygame» is the name of the docker image that contains your GUI application (in this case, my container’s name is pygame and the GUI is xclock)
For security purposes, you can use socat option range=
You can also launch a bash shell first and from there, run your GUI apps.