Containerize GUI Applications on Mac

August 5, 2016

After watching Container Hacks and Fun Images by Jessie Frazelle, I wanted to Containerize my GUI applications on OS X.

This guide is tested under

It also works well under OS X(10.11.5) and Docker for Mac(1.12 stable) but XQuartz version must be 2.7.1_beta2(latest as of now). As pointed by Fredrik Averpil, there is a bug in XQuartz 2.7.9 stable version, which prevents opening the display from remote.

Note: After installing XQuartz you need to log out and log in back.

Running a container

$ open -a XQuartz
$ docker run -d --name firefox -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox

xQuartz preference

Edit: There is a new post with improved security using xauth instead of xhost.