I'd like to run an application in a Docker container that can start a GUI. This guide recommends using XQuartz. After starting XQuartz, run the following:
ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
xhost + $ip
docker run -d --name firefox -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox
This gives your local device permission to access the host server. Running the above, I get the error:
cannot connect to X server 10.0.0.69:0
Best Answer
I was not using the right display number. The guide above uses the default display number
:0
.Find the correct one by running:
Then change your docker run command to include the flags: