54 CHEN

How to Run GUI App in Docker on Osx

This is a quick guide explaining how to run GUI app in docker on mac osx.

step 1.install two important tools

#brew cask install xquartz
  
  #brew install socat

step 2.run socat

socat TCP-LISTEN:6001,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" &

step 3.see what your real en* by ifconfig

#ifconfig

You can see en0 en1 en2 and so on,choose a right one which has the right IP addrass.

step 4.run docker

docker run -it -e XAUTHORITY=/tmp/xauth -v ~/.Xauthority:/tmp/xauth -e DISPLAY=$(ifconfig en3 | grep 'inet '|awk '{print $2}'):1 --net host --volume=$(pwd):/workspace fastercnn /bin/bash

attention: You must modify the DISPLAY,replace the “ifconfig en*” by the one which choosed in step 3.

Good luck!

原创文章如转载,请注明:转载自五四陈科学院[http://www.54chen.com]

Posted by 54chen docker

« 生娃指北 生娃指北-采购篇 »