Open imphil opened 3 weeks ago
As the information about the actual dev container used is not provided, I have tried installing a simple GUI app (one of the sample apps provided in the wslg repo's README page) and could reproduce the behavior you described in the issue description, i.e. the GUI app not working within the rancher-desktop
distro but working within a Ubuntu distro, which makes me also think that it's some alpine-wslg compatibility/configuration issue and I do not have anything on top of my head to suggest for a fix.
I'm happy to investigate further why the X forwarding doesn't work with the rancher-desktop WSL2 distro.
Yes please. It would be great if you can explore further and could figure out a way to get wslg working within the default rancher-desktop
distro. If you have success, please do share your learnings here.
Or is this distro only meant to run docker itself, and users should use another WSL2 distro to actually run their containers in there?
Yes, it's by design that the core components such as the container engine, kubernetes etc run in the rancher-desktop
distro and hence the containers actually run in the distro as well. To my knowledge there's no way to run containers in other distros you expose Rancher Desktop's configuration to. Exposing the Rancher Desktop's configuration to other distros just allows you to interact with the container engine, containers etc running in the rancher-desktop
distro.
Summary: As Windows user, I want to run graphical applications in a VS Code Dev Container with the default installation of Rancher Desktop. Currently, that doesn't work with the default rancher desktop WSL2 distro, but only with a separately installed and configured Ubuntu WSL2 distro.
User Setup:
Background:
WSL2 has a built-in X/Wayland server, enabling users to run graphical applications within a WSL distro, without further installation steps needed (i.e., users do not need to install a separate X server on Windows). This feature is called WSLg and enabled by default in recent WSL2 versions.
VS Code Dev Containers forwards all necessary Wayland and X sockets from WSL2 to Dev Containers by default, enabling users to run GUI applications inside the Dev Container.
The problem: With a default installation of Rancher Desktop, the Alpine Linux-based rancher-desktop WSL2 distro is used to run Dev Containers in VS Code (since it's the only and default WSL2 distro available in a clean installation). This WSL2 distro does not (for yet unknown reasons) work with WSLg, ultimately resulting in users not being able to run GUI applications in their Dev Container (the
DISPLAY
environment variable is not set).Workaround: With the Ubuntu WSL2 distro, graphical applications work in containers. I.e., the workaround is: Install the ubuntu WSL2 distro, set it as default in WSL2, and configure Rancher Desktop to expose the docker daemon to it.
Question: I'm happy to investigate further why the X forwarding doesn't work with the rancher-desktop WSL2 distro. But before I do so: is it the intended use case of the rancher desktop WSL2 distro to run containers in there? Or is this distro only meant to run docker itself, and users should use another WSL2 distro to actually run their containers (I think that's how Docker Desktop operates). Ultimately, I'm looking for a solution that works as easily as possible for the user, the less additional steps they have to take at installation time, the better.