why systemd is disabled in WSL? [closed]

Posted on Jul 15, 2023

Question

None of the systemd commands are working inside WSL( Ubuntu Bash 18.04). When I ran sudo systemctl is-active kubelet, error is output: System has not been booted with systemd as init system (PID 1). Can't operate. : running command: sudo systemctl is-active kubelet

How to enable systemd feature in WSL? Whats the way to get rid of System has not been booted with systemd

Answer

When using WSL2 you can use:

sudo service docker start

This command basically execute the script /etc/init.d/docker.

Some customization, like specifying HTTP proxy, is possible via the script /etc/default/docker.