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:
- Open up Task Scheduler
- Create new Basic Task
- Name it like you will, mine was “Autostart of WSL Docker service on boot”
- Next, then choose “When the Computer Starts”
- Next, then “Start a program”
- In “Program/script” find WSL.exe, it should be located like so:
“C:/Windows/System32/wsl.exe” - In “Add arguments (optional)” enter following:
-d Ubuntu-20.04 -u root service docker start - Finish the setup via “Next” then “Finish”.
- Run it to test it.
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
Leave a Reply