-
Notifications
You must be signed in to change notification settings - Fork 841
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
WSL terminates systemd service docker containers when last terminal is closed #9667
Comments
This is by design. The VM hosting WSL will idle-terminate when:
We do have an undocumented config option that disables this behavior, let me chat with the team a bit to see if that's something we should officially support. |
Oh please, that would be truly amazing |
That would be perfect. Can you share how to do that, unofficially -- just between the two of us here, on this GitHub issue 😅 |
Mhhh...maybe this hidden feature is something which would also solve #6782 😄 |
I mean the unstoppable idle termination is probably amazing for battery-powered devices, but on a desktop where the power use variation is so small in the grand scheme of things, it doesn't really have any upside... |
@benhillis Do you happen to have an update on this (specifically, the undocumented config option)? |
since i do not want to install systemd or anything else just as a workaround for this stupid issue, i prefer to run a single line on every work day start. from windows host wsl screen from windows host wsl tmux new -s backgroundsession from wsl nohup sleep 1d WARNING: this is set to run for 1 day! in case you want to terminate, or rollback without restart wsl, you can run |
Just experienced the same.
To be clear: This behaviour causes data loss for users! My tmux session was not a systemd process, but a normal backgrounded process by me, which got ignored by this. IMHO the lifecycle of the WSL process tree (VM,...) should not be tied to a frontend application interacting with it (Terminal), at least not with the default configuration. |
You forgot to ask the users when designing this 🤣 and no. not everyone wants to pay for Docker Desktop - actually - now it makes me think how they manage to do that now on their hidden vm?? |
This must be the best work around. I made a ps1 file that runs with Windows Task Scheduler,
It flashes a terminal briefly but I find that to be a very acceptable "solution"
|
Is anyone willing to spill the beans on this secret setting? It's kind of shocking that it's partway through 2024 and this fairly basic feature is completely hidden to the user/system admin. |
benhillis It's been almost two years since you posted, could we at least enjoy the courtesy of you returning with update on this? |
Version
Microsoft Windows [Version 10.0.22621.1265]
WSL Version
Kernel Version
5.15.79.1-microsoft-standard-WSL2
Distro Version
Ubuntu 22.04
Other Software
docker with systemd option enabled on wsl2
Repro Steps
sudo apt install docker.io docker-compose
start any docker container (a simple one is an nginx container)
close all terminal windows connected to the wsl instance/ Ubuntu 22.04
wait 10-20 seconds
open a new terminal window to the Ubuntu 22.04
run
docker ps
and notice that everything was restarted (indicated by the uptime being only since you opened the new terminal window)Expected Behavior
I expected the systemd services, like docker, to continue running even when I close my terminals.
Actual Behavior
The services shut down when the terminals are closed.
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: