Take the following dockerfile:
FROM debian:bookworm
RUN apt-get update && apt-get install -y firefox-esr
CMD firefoxBuild it with: docker build . -t firefox
Run the container like this:
xhost + # Disables X server authorization. Run `xhost -` later to turn auth back on
docker run -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix firefox
You can follow this for a vanilla Mac:
Install XQuartz if you haven't already:
Launch XQuartz:
In XQuartz preferences, go to the Security tab and ensure "Allow connections from network clients" is checked46.
Restart XQuartz for the changes to take effect.
Allow connections to your local X server:
Identify your host machine's IP address:
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')Add the IP to the X server's access control list:
xhost + $IPRun your Docker container with the following modifications: