Dev Notes

Start WSL 2 Service on Host startup

For me, that’s docker.My docker is running independantly of docker desktop on the host so i want it to startup when the PC is booted.

Ramazan Yavuz
Ramazan Yavuz ·

Or: “I don’t want to manually startup everything in WSL after every boot”

For me, that’s docker.
My docker is running independantly of docker desktop on the host so i want it to startup when the PC is booted.

Following easy steps to set it up in Task Scheduler:

Instead of “Ubuntu-20.04” you might want to find your correct distro name by entering
“wsl –list” into a commandline on windows, you’ll need to use the same distro name displayed for the distro of your choosing.

Edit:
if this doesn’t immediately work for you, you might want to open up the task in task-scheduler, navigate to “triggers”, open the trigger and set “Delay Task for” to 30 seconds or any amount that makes sense for your system start-up time.

That’s it.
Enjoy.
Many thanks to StackOverflow user octagon_octopus


Originally published on blog.yavuz.support: https://blog.yavuz.support/start-wsl-2-service-on-host-startup.