Map your hosts ~/.Xauthority file into your docker container via -v ~/.Xauthority:/root/.XauthorityĪpplied to the XClock sample above: $ docker run -v ~/.Xauthority:/root/.Xauthority -e DISPLAY=. That file is read by X11 clients and the cookies available there are used to authenticate the connections. When you login through some kind of a display manager, a MIT-MAGIC-COOKIE-1 authentication cookie is created and written to your hosts ~/.Xauthority file. The updates available on this site are not official Apple releases. Together with supporting libraries and applications, it forms the X11.app that Apple shipped with OS X versions 10.5 through 10.7. If cli-arg –nolisten tcp is set it wont allow any outside connections. XQuartz for Mac is an open-source effort to develop a version of the X.org X Window System that runs on Mac OS X. If error is still present, ensure XQuartz is allowing network connections. FAQs Error: Can't open display: :0 → what to do? If you want a Docker container or actually any unix client to use your Mac as X11 server, simply set the DISPLAY env variable to your ip-address and display-port.įor Docker containers, you can pass the DISPLAY variable via -e DISPLAY=ip:display-port or enter the container and set the DISPLAY env accordingly. Stop XQuartz and X11 if you don't need it. Your Mac is now an unsecured remote X11 server on the network, be aware of this! Success, good old XClock should be displayed on your screen :) $ docker run -e DISPLAY=.internal:0 sshipway/xclock I can see that it tries to open it but fails and closes and again immediately. On both OS I tried to install gedit manually and via homebrew and on both it doesnt open at all. Pull the following docker container, set the DISPLAY env and run it. I have the same issue with gedit on my Intel iMac 2015 and my MacBook Pro M1 (both latest possible versions). If you have security concerns you can append an IP address for a whitelist mechanism.Īlternatively, if you want to limit X11 forwarding to local containers, you can limit clients to localhost only viaīe ware: You will always have to run xhost + after a restart of X11 as this is not a persistent setting. Important is that its not saying –nolisten tcp which would block any X11 forwarding to the X11 display. :0 means the display is running on display port 0. Restart your Mac and start XQuartz again`Ĭheck if XQuartz is setup and running correctlyĮnsure that XQuartz is running similar to this: /opt/X11/bin/Xquartz :0 -listen tcp ![]() Go to Security Settings and ensure that "Allow connections from network clients" is on Logout and login of your Mac to activate XQuartz as default X11 server What worked for me was adding this to the workflow file: - name: Install XQuartz on macOS if: runner.os macOS run: brew install xquartz -cask. docker desktop 2.2.0.5 (43884) - stable release Here was the command I had to use to install X11 and XQuartz via GitHub Actions: brew install -cask xquartz.A quick guide on how to setup X11 forwarding on macOS when using docker containers requiring a DISPLAY.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |