If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.
DDEV add-on to enable launching GUI apps from the DDEV container using connection to the X11 server on the host.
ddev add-on get MurzNN/ddev-x11
If you want to launch a GUI program from the DDEV container, it usually fails with an error:
Error: Can't open display:
This add-on fixes the issue by mounting the X11 Unix socket to the container and providing a DISPLAY env variable.
This should work well on Linux with Wayland environments too.
Probably, this way will work on MacOS and Windows too, but not tested, so share your feedback.
ddev ssh
sudo apt update && sudo apt install x11-apps -y
xeyes
Probably you have a question why do we need to run GUI apps from the container, instead of the host system, right?
Usually, it is needed to run Playwright tests using the container’s environmnet and internal network with seeing the real browser GUI window (Chromium, Firefox, Chrome, Edge) launched from the DDEV contaner with all real clicks.
This approach works with VS Code’s Playwright extension run from the VS Code instance attached to the DDEV web contaier out of the box without any special changes.
web_environment:
- DISPLAY=:0
There is another solution to achive the same result without mounting the Unix socket:
xhost +local:docker"
web_environment:
- DISPLAY=host.docker.internal:0
ddev ssh
nc -zv host.docker.internal 6000
This approach looks more simple, but it might not work if a firewall is enabled and blocks some network connections.
Therefore, a more stable approach is chosen by default.
If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.