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 socat

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

step 3.see what your real en* by ifconfig


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

step 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!