WSL2
警告 “wsl2” 模式是实验性的
⚡ 要求 | Lima >= 0.18 + (Windows >= 10 Build 19041 或 Windows 11) |
---|
“wsl2” 选项使用 Windows 的 wsl.exe
提供的原生虚拟化支持(更多信息)。
配置示例:
limactl start --vm-type=wsl2 --mount-type=wsl2 --containerd=system
# 使用 vmType: wsl2 运行 Fedora 的示例
vmType: wsl2
images:
# 来源:https://github.com/runfinch/finch-core/blob/main/Dockerfile
- location: "https://deps.runfinch.com/common/x86-64/finch-rootfs-production-amd64-1690920103.tar.zst"
arch: "x86_64"
digest: "sha256:53f2e329b8da0f6a25e025d1f6cc262ae228402ba615ad095739b2f0ec6babc9"
mountType: wsl2
containerd:
system: true
user: false
注意事项
- “wsl2” 选项仅在较新版本的 Windows 上受支持(大致是 2019 年以来的任何版本)
已知问题
- “wsl2” 目前不支持 Lima 的许多选项。有关最新支持的选项,请参见此文件。
- 使用 “wsl2” 运行 lima 时,
${LIMA_HOME}/<INSTANCE>/serial.log
将不包含内核启动日志 - WSL2 需要
tar
格式的 rootfs 归档文件而不是 VM 镜像 - Windows 没有随附 Lima 在各个地方使用的 ssh.exe、gzip.exe 等。最简单的解决方法是运行
winget install -e --id Git.MinGit
(winget 现在也内置于 Windows 中),并将生成的C:\Program Files\Git\usr\bin\
目录添加到你的路径中。