Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL2 Missing X server when running Windows Docker container #529

Open
rsenden opened this issue Sep 5, 2024 · 4 comments
Open

WSL2 Missing X server when running Windows Docker container #529

rsenden opened this issue Sep 5, 2024 · 4 comments
Labels
🔖 ADO Has corresponding ADO item question Further information is requested

Comments

@rsenden
Copy link

rsenden commented Sep 5, 2024

I've been successfully running WSL2 Ubuntu on my company-managed Windows 11 Pro 23H2 (OS build 22631.4037) workstation. For Linux GUI applications, I'm using the following setup (due to some earlier issues with WSLg):

  • guiApplications=false in .wslconfig
  • VcXsrv on Windows as the X server
  • DISPLAY=:0
  • LIBGL_ALWAYS_INDIRECT=1

I'm also building and running Linux Docker containers in this WSL2 instance, but I don't think this is related to the issue below.

Today, I installed Docker CE engine on Windows to allow for building and running Windows images, using instructions provided at https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce#windows-server-1. All good so far; after a reboot I can still run X applications from my WSL2 instance.

However, as soon as I run a Windows container, for example by running docker run --rm -it mcr.microsoft.com/windows/nanoserver:ltsc2022 cmd.exe from a PowerShell or CMD.exe console, all my WSL2 GUI applications disappear. Attempting to start a new GUI application from my WSL2 instance (in this example Google Chrome) shows the following error messages:

[10982:10982:0905/163020.111216:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[10982:10982:0905/163020.111406:ERROR:env.cc(258)] The platform failed to initialize.  Exiting.

Stopping or removing the Windows container doesn't help; the only way I've found so far to recover from this situation is by rebooting my machine. Any ideas as to why this may be happening, or how to troubleshoot or fix this issue?

@rsenden rsenden added question Further information is requested triage New and needs attention labels Sep 5, 2024
@vrapolinario
Copy link
Contributor

How are you running the WSL2 Linux containers? Are you running Docker Desktop for that? AFAIK, you can't run both with the Docker engine, you need to change the docker engine parameters to run either Linux or Windows.

@rsenden
Copy link
Author

rsenden commented Sep 5, 2024

How are you running the WSL2 Linux containers? Are you running Docker Desktop for that? AFAIK, you can't run both with the Docker engine, you need to change the docker engine parameters to run either Linux or Windows.

I don't have Docker Desktop on my system; I installed the Linux Docker Engine on my WSL2 Ubuntu instance (and as mentioned in my original post, I installed the Windows Docker Engine on Windows today). Starting a Windows container on Docker Engine for Windows doesn't have any impact on my running WSL2 containers, and vice versa. Running docker ls on Windows only shows my Windows containers, running the same in WSL2 shows only Linux containers.

@ntrappe-msft ntrappe-msft removed the triage New and needs attention label Sep 6, 2024
@ntrappe-msft ntrappe-msft added the 🔖 ADO Has corresponding ADO item label Oct 2, 2024
@ntrappe-msft
Copy link
Contributor

Triaging to the broader team to get more eyes on this.

Copy link
Contributor

This issue has been open for 30 days with no updates.
no assignees, please provide an update or close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔖 ADO Has corresponding ADO item question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants