Skip to content

Latest commit

 

History

History
77 lines (51 loc) · 1.73 KB

docker_mac_gui_app.md

File metadata and controls

77 lines (51 loc) · 1.73 KB

...menustart

...menuend

Docker for Mac and GUI applications

https://fredrikaverpil.github.io/2016/07/31/docker-for-mac-and-gui-applications/

1. install xquartz

brew install xquartz

reboot Mac

2. setup xquartz

  1. run XQuartz
    open -a XQuartz
    • a xterm window should popup
  2. In the XQuartz preferences, go to the “Security” tab and make sure you’ve got “Allow connections from network clients”
  3. run xhost and allow connections from your local machine
    ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
    xhost + $ip 
  4. find your displaynumber
    display_number=`ps -ef | grep "Xquartz :\d" | grep -v xinit | awk '{ print $9; }'`
    echo $display_number
  5. test an GUI app, e.g. firefox
    docker run --rm  --name firefox -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox 

Other example

matplotlib X11 test program

import matplotlib
matplotlib.use('tkagg')
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.show()