VcXsrv Windows X Server Setup¶
VcXsrv is a Windows X Server application that allows graphical user interface (GUI) applications running inside environments like [[WSL]] or [[Docker]] to display on a Windows host machine^[600-developer__docker-run-command.md].
Installation¶
The specific version referenced for setup is vcxsrv-64.1.20.14.0.installer.exe^[600-developer__docker-run-command.md]. The installer can be downloaded from the SourceForge repository^[600-developer__docker-run-command.md].
Configuration¶
To enable GUI forwarding, the DISPLAY environment variable must be configured on the Linux client side (e.g., within WSL)^[600-developer__docker-run-command.md]. A common method to automate this is to add an export command to the shell profile, such as .bash_login, which dynamically sets the display address using the WSL's nameserver IP^[600-developer__docker-run-command.md]:
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
After saving this configuration, the WSL terminal needs to be reopened for the changes to take effect^[600-developer__docker-run-command.md].
Usage¶
Once the server is running and the environment is configured, X11 forwarding can be utilized. For example, a Docker container running a GUI application can be launched by mounting the X11 socket and setting the DISPLAY variable^[600-developer__docker-run-command.md]:
docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$DISPLAY \
--name [container-name] \
[image-name]
Sources¶
- 600-developer__docker-run-command.md