我的机器windows 11 家庭版
下载docker desktop for windows 就直接安装了。安装后打开,遇到了界面转圈圈加载不出来问题,docker engine也是stopped.
病急乱投医,先是说要启用hyper-v,控制面板=》程序和功能里没有发现有hyper-v,一看是家庭版,网上倒是有一个脚本可以在家庭版安装hyper-v(先别装,继续往下看)
pushd "%~dp0"dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txtfor /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"del hyper-v.txtDism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
这个脚本以cmd为后缀,管理员运行该脚本,安装一系列包后就可以安装好,最后会让你确认是否重启。
hyper-v装好,发现还是没解决问题,又看到说是要安装wsl2,这个啥鬼,没研究过。因为我是win 11,已经安装了wsl,只需要更新下即可
wsl --update --web-download
,更新完docker desktop里的docker engine就可以正常启动了。
我后来看了下docker desktop文档https://docs.docker.com/desktop/setup/install/windows-install/,如下这段有说明
Should I use Hyper-V or WSL?
Docker Desktop's functionality remains consistent on both WSL and Hyper-V, without a preference for either architecture. Hyper-V and WSL have their own advantages and >disadvantages, depending on your specific set up and your planned use case.
应该是hyper-v和wsl2只要有一个就好,但因为我已经装了hyper-v,就不好去验证了。
虽然原本只想在Windows下使用docker,结果遇到了一些问题,折腾了2小时,不过也遇到一些新东西,比如wsl就有待探索下,目前我理解就是在Windows下不装虚拟机就可以体验linux。
下面截2个图记录下,