-
Notifications
You must be signed in to change notification settings - Fork 15
docker_graphics_macos
Claire Guépin edited this page Apr 16, 2025
·
26 revisions
- XQuartz installation
- restart computer
- install Docker with your CPU version
- in the Docker application go to
preferences > resourcesand add more memory - X11 preference security, select "Allow connection from network clients"
- restart Docker application
- retrieve your
<IP>address (inet) in a Terminal shell with:
ifconfig en0
- open a Terminal shell within the XQuartz application (only needed for this step) and add
xhost +or
xhost <IP>- add this option to the
docker runcommand when creating a container
-e DISPLAY=<IP>:0
python -m tkinter
If this does not work, one solution is to run socat, to forward a TCP port to a UNIX socket. You'll need to install socat, ex. brew install socat. Then, in a terminal
socat TCP-LISTEN:6001,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
Then run the docker, for instance
docker run -p 8888:8888 -e DISPLAY=host.docker.internal:1.0 -it --rm -v $PWD:/home grandlib/dev
Watch this video