Skip to content

Instantly share code, notes, and snippets.

@rizky
Last active May 30, 2021 22:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rizky/96ef3ff65d0bba75b428598d711a3c03 to your computer and use it in GitHub Desktop.
Save rizky/96ef3ff65d0bba75b428598d711a3c03 to your computer and use it in GitHub Desktop.
Run GUI app from docker
#Install XQuartz and Docker
brew cask install xquartz
brew cask install docker
# Open XQuartz
# In the XQuartz preferences, go to the “Security” tab
# Make sure you’ve got “Allow connections from network clients” ticked
open -a XQuartz
# Setup ENV
export IP=$(ifconfig -a | grep "inet " | sed 's/.*inet \([0-9\.]*\).*/\1/g' | grep -v "127.0.0.1" -m1)
export DISPLAY=$IP:0
# Add ENV to XQuartz
/usr/X11/bin/xhost +
# Run Docker Image
docker run -d --name firefox -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox
@rizky
Copy link
Author

rizky commented May 29, 2018

xquartz_preferences

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment