How to display a gui from a linux container on a host Mac OSX machine:
- Ensure that xquartz is installed, using homebrew:
brew install xquartz socat
You may need to log out and log back in if xquartz was not already installed
- Open xquartz:
open -a Xquartz
and configure "Allow connections from network clients" to ON.
- Ensure that
socat
is installed, and then run a socat bridge between TCP port 6000 (default for X window system) and the unix domain socket for the Mac's xquartz display.
brew install socat
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
This bridge will run indefinitely, until you kill it.
- In another shell, get the IP address of your Mac OSX machine, eg:
ifconfig en0
...
inet 10.0.1.46 netmask 0xffffff00 broadcast 10.0.1.255
...
- Run your docker container, providing the
DISPLAY
environment variable that will be used by the container to access your mac's X windows display.
docker run -it --rm -e DISPLAY=10.0.1.46:0 --name=running-buster -v/Users/todd/Documents/proj/busterama/stuff:/root/stuff buster-runner
- Assuming your container opens a GUI, it should appear on your Mac's display