-
Notifications
You must be signed in to change notification settings - Fork 822
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
Problem launching Windows processes from inside WSL2 Docker #10883
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! Open similar issues:
Closed similar issues:
|
/logs |
Logfiles are attached here. During recording, I captured one successful launch (asking Docker to run |
Thank you @nrclark. The issue is that the executable that runs windows executables has special logic when its pid is 1, and inside a docker container it will behave that if it's the first process. This is a bug, but until it's fixed you can work around it like this:
|
Thanks @OneBlue. I also noticed something else that might be related. When I have
gives me a different error than before. Instead of that
Note that if I run This error occurs when:
I took a log capture of this happening and attached it to this ticket. |
@nrclark does adding
or equivalent
but I could swear this used to work without, but now I'm starting to doubt my memory. 🤷 |
@ndreys thanks for the pro-tip! You're right, that got .exe execution working under Docker when systemd is active. It's interesting that .exe execution works in non-systemd Docker without the explicit /init binding - maybe some more PID1 trickery. The main issue in my ticket is still active though, and is unrelated to the secondary issue that @ndreys addressed. |
Windows Version
Microsoft Windows [Version 10.0.19045.3448]
WSL Version
2.0.9.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.133.1-1
Distro Version
Ubuntu 22.04
Other Software
Docker CE, version 24.0.7. Installed on WSL2 from Docker's apt repo.
Notepad.exe
Repro Steps
I am working on a project that needs to run Windows applications from inside of a WSL2 Docker container. When I try to launch a Windows application directly (notepad.exe used as an example), I get a strange failure. The failure doesn't occur if I launch it from inside of a shell instead.
Inside of WSL2 (with dockerd running as
sudo
in another tab), this command fails:with the following error:
but this one succeeds OK:
Interestingly, I also see that
bash -c '/mnt/c/Windows/system32/notepad.exe'
fails in the same way, even thoughsh -c '/mnt/c/Windows/system32/notepad.exe'
works just fine. I can also make a script with the contents of:and run that instead of a shell, and it works as expected.
What's going on here? Can anybody help me out with a workaround?
Expected Behavior
In all cases, notepad should launch identically.
Actual Behavior
Launching notepad.exe from
sh
/dash
works, as does putting it in a shell-script that runs underbash
. Launching it directly fails, as does launching it frombash
(even though that works when placed in a script).All failures produce this message on stderr:
Diagnostic Logs
I couldn't think of any useful dianostic logs. Let me know if there's anything specific that you'd like to see.
The text was updated successfully, but these errors were encountered: