Running GUI applications with Docker in OSX

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= pygame xclock

I’m assuming that 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=/32 to filter the IP address (allowing only your primary IP to connect). Check also your XQuartz Preferences / Security tab:


You can also launch a bash shell first and from there, run your GUI apps.


Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.