windows10 wsl2 安装ubuntu和docker
见 弃用Docker Desktop:在WSL2中玩转Docker之Docker Engine 部署与WSL入门-阿里云开发者社区
如果启动docker时报下面这个错, 那是因为systemctl没有启用
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
# 1. 在ubuntu中编辑 WSL 配置文件
sudo tee /etc/wsl.conf <<EOF
[boot]
systemd=true
EOF
# 2. 重启 WSL(在 PowerShell 中执行)
wsl --shutdown
# 3. 重新进入 WSL 后验证
ps -p 1 -o comm= # 应显示 systemd
sudo systemctl start docker