> 技术文档 > Docker提示WSL integration with distro ‘Ubuntu‘ unexpectedly stopped. Do you want to restart it?_wsl integration with distro \'ubuntu\' unexpectedly

Docker提示WSL integration with distro ‘Ubuntu‘ unexpectedly stopped. Do you want to restart it?_wsl integration with distro \'ubuntu\' unexpectedly

WIN电脑下载Docker之后,报错:

WSL integration with distro \'Ubuntu\' unexpectedly stopped. Do you want to restart it?

即使点击Skip Ubuntu WSL distro和Resrt the WSL integratrion也会一直弹这个对话框

具体内容:

retrieving homedir for Ubuntu distro: getting home folder for Ubuntu distro: running echo $HOME in Ubuntu: sending to distro: write |1: The pipe is being closed.

参考了https://blog.csdn.net/xuukai/article/details/145671668

知道报错原因是Version不匹配,WSL用了VERSION 1,所以要进行版本升级VERSION 2

具体解决措施:

步骤 1:检查当前 WSL 版本支持

wsl --list --verbose

如果显示 Stopped 状态且版本为 1,说明需要升级。

步骤 2:设置默认 WSL 版本为 2

运行以下命令,将系统的默认 WSL 版本设置为 2:

wsl --set-default-version 2

步骤 3:将 Ubuntu 设置为 WSL 2

使用以下命令将 Ubuntu 的版本从 WSL 1 升级到 WSL 2:

wsl --set-version Ubuntu 2

执行后,系统会提示正在转换分发版的版本,并可能需要一些时间完成操作。

 

步骤 4:验证版本更新

再次运行以下命令,确认 Ubuntu 的版本已更改为 2:

wsl --list --verbose

此时点击Docker按钮Resrt the WSL integratrion就不再弹对话框了!