A quick guide on how to setup X11 forwarding on macOS when using docker containers requiring a DISPLAY.
This guide was tested on:
- macOS Catalina 10.15.4
- docker desktop 2.2.0.5 (43884) - stable release
- XQuartz 2.7.11 (xorg-server 1.18.4)
| # 0. ON WINDOWS : | |
| # On windows, to check which WSL you use, type ` wsl --list --verbose ` in admin cmd. | |
| # If you are not in WSL2, reinstall the machine with WSL2 : https://docs.microsoft.com/fr-fr/windows/wsl/install-win10 | |
| # 1. Make sure you are running with systemd | |
| # sudo systemctl must not say "Failed to connect to bus" | |
| # If so, I recommand you to reinstall the VM. You can try this repo too : https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git | |
| # 2. On WSL2 machine | |
| # /!\ Create an user with A PASSWORD and with sudo access |
| """ | |
| run python web.rewrite.example.py | |
| and then open a browser to localhost:8080/data/foo/bar | |
| The two segments of the path below /data are transformed into query | |
| arguments using the rewrite function pathToArgs. | |
| The root resource is wrapped with the rewrite resource | |
| The second arg to RewriterResource is the rewrite function. |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000