Skip to content

Instantly share code, notes, and snippets.

@roaldnefs
Created December 22, 2019 10:27
Show Gist options
  • Save roaldnefs/fe9f36b0e8cf2890af14572c083b516c to your computer and use it in GitHub Desktop.
Save roaldnefs/fe9f36b0e8cf2890af14572c083b516c to your computer and use it in GitHub Desktop.
Running GUI application in Docker on MacOS
# Install XQuartz
brew cask install xquartz
# Restart MacOS
# Open XQuartz
open -a XQuartz
# Ensure the "Allow connections from network clients" option in Preferences >> Security is turned on
# Add localhost as an allowed source
xhost + 127.0.0.1
# Run a Docker container, e.g. Firefox
docker run -e DISPLAY=host.docker.internal:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox
@Legion112
Copy link

Legion112 commented Jul 6, 2023

You should add directory to path to allow to run xhost export PATH="/opt/X11/bin:$PATH"
Or use full path /opt/X11/bin/xhost

Thanks to https://gist.github.com/cschiewek/246a244ba23da8b9f0e7b11a68bf3285?permalink_comment_id=3744661#gistcomment-3744661

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