Skip to content

Instantly share code, notes, and snippets.

@mluis
Last active October 5, 2017 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mluis/319879b84d1fd493e1b62c6c60c871a3 to your computer and use it in GitHub Desktop.
Save mluis/319879b84d1fd493e1b62c6c60c871a3 to your computer and use it in GitHub Desktop.
Share screen between OSX and Docker
#!/usr/bin/env bash
brew install socat xquartz && open -a XQuartz
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" &
display_number=`ps -ef | grep "Xquartz :\d" | grep -v xinit | awk '{ print $9; }'`
ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
# eg. docker ... -e DISPLAY=$ip$display_number -it <container> bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment