Windows装docker踩坑记录

360次阅读
没有评论

共计 1650 个字符,预计需要花费 5 分钟才能阅读完成。

Docker 让配置应用程序的环境简化了不少,之前在 Linux 服务器上用得可香了。而最近我想在我那台 Windows 10 老笔记本也配置一个 Docker,本以为也会很简单,没想到也折腾了一两个小时才搞好。

首先,去 https://www.docker.com/products/docker-desktop/ 官网,下载 Docker Desktop 并安装,安装十分顺利。

然后,运行时就报了 Docker Desktop requires a newer WSL kernel version. 错误。不过不慌,报错窗口给出了解决方案:

wsl --update

不就升级一下嘛,考虑到机器本身很久没更新过了,也不知道预装的 WSL 是啥版本的,需要升级,很合理。但是升级完之后,遇到了个更麻烦的问题Docker Desktop - Unexpected WSL error。除了重启,并没有给出一个明确的解决方案。网络上有博主(https://blog.csdn.net/Azbtt/article/details/132182380)给出了解决方案,但对我并没有效果;还有一篇是说在控制面板中卸载并重装相关服务(https://zhuanlan.zhihu.com/p/617468891)也没有作用。

不过问题肯定出在 WSL 上,根据微软官方文档(https://learn.microsoft.com/zh-cn/windows/wsl/install),我们在命令行手动装一下:

C:\WINDOWS\system32>wsl --install
正在安装: Ubuntu
已安装 Ubuntu。正在启动 Ubuntu...
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.
For information please visit https://aka.ms/enablevirtualization
Press any key to continue...
分发“Ubuntu”的安装过程失败,退出代码:1。Error code: Wsl/InstallDistro/WSL_E_INSTALL_PROCESS_FAILED

乐,搞了半天原来 WSL 都没装上,提示让我进主板启动虚拟化。那就开机 F10 进主板,启用 CPU 虚拟化,重启,再次安装:

C:\Users\GmeiZ>wsl --install
Ubuntu 已安装。正在启动 Ubuntu...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: Pegasus
adduser: Please enter a username matching the regular expression configured
via the NAME_REGEX[_SYSTEM] configuration variable.  Use the `--force-badname'
option to relax this check or reconfigure NAME_REGEX.
Enter new UNIX username: ******
New password:
Retype new password:
passwd: password updated successfully
Installation successful!

安装成功后,Docker Desktop 便能正常启动。

正文完
 
小唏
版权声明:本站原创文章,由 小唏 2023-10-09发表,共计1650字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码