This is a short guide explaining how to run GUI applications from within Docker on Mac. This uses XQuartz to enable to set the DISPLAY
variable within the container.
You can install XQuartz using homebrew with brew cask install xquartz
or directly from the website here. At the time of writing, I had 2.7.11
installed on my machine with OSX El Capitan. After installing XQuartz restart your machine.
If there is no physical El Capitan disc/USB thumb drive and I install El Capitan but run into trouble what can I do? If you downloaded El Capitan from the Mac App Store: When El Capitan is installed it creates a special bootable emergency 'recovery' area on your hard disk. Mac OS X starting from Yosemite. In the last versions of Mac OS X (Yosemite, El Capitan), the X11 program is no longer included. The XQuartz project was created by Apple as a community effort to allow old programs (like Darwine) to run on Mac OS X by using the same X11 libraries. So, you just have to install XQuartz, and then you'll get the X11. From my past experience, you're having trouble with GOG's Mac games that are WINE wrappers for Windows games. The wrappers are created through Wineskin (IIRC), and, to make a long story short, Wineskin had issues working on El Capitan due to 10.11's new System Integrity Protection feature.
Install docker using brew cask install docker
or directly from the website here.
Start XQuartz from command line using open -a XQuartz
. In the XQuartz preferences, go to the “Security” tab and make sure you’ve got “Allow connections from network clients” ticked:
IP=$(ifconfig en0 | grep inet | awk '$1'inet' {print $2}')
should set the IP
variable as the ip of your local machine. If you’re on wifi you may want to use en1
instead of en0
, check the value of the variable using echo $IP
.
Now add the IP using Xhost with xhost + $IP
. If the xhost command is not found check /usr/X11/bin/xhost
as that might not be in your path.
You can now try running firefox in your container with:
or run octave using: