Windows11 的 WSL 中的docker启动失败

sudo systemctl start docker
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

如果是一般的Linux操作系统,可能是因为Linux中没有使用systemd,想用systemd命令来管理Linux上的服务,因此会报错,很可能是使用的是经典的SysV init(sysvinit)系统。
但我这个是window11下WSL的Ubuntu,就会使SysV init而不是systemd
解决方法:
更换命令,用SysV init的命令代替systemd的,对应关系如下:

Systemd commandSysvinit command
systemctl start service_nameservice service_name start
systemctl stop service_nameservice service_name stop
systemctl restart service_nameservice service_name restart
systemctl status service_nameservice service_name status
systemctl enable service_namechkconfig service_name on
systemctl disable service_namechkconfig service_name off

sudo service docker start

启动成功