Running a Docker Container with GUI on Mac OS

Got the idea/big picture from here:, but had to do some more steps:

1. Install XQuartz

brew install xquartz

2. Run XQuartz

open -a XQuartz

3. Allow Network Connections (XQuartz/Preferences):

4. Get the Host IP

IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')

5. SET DISPLAY Environment Variable

export DISPLAY=$IP:0

6. Add Path to “xhost” to my zsh-Profile; added this line to .zshrc:

export PATH=/usr/X11/bin/xhost:$PATH

7. Added the IP with xhost

xhost + $IP

8. Run Firefox from Docker Container

docker run -d --name firefox -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox