Windows10家庭版安装Docker(不是DockerToolbox)

1、问:Windows家庭版的并不能直接安装Docker Desktop,因为家庭版的不支持Hyper -V,所以要先写个脚本让家庭版的可以开启Hyper服务

      答:创建一个任何名字的文本文档,把下面的代码复制进去,然后保存,接着修改文本文件的后缀(.txt)为.cmd,右击该.cmd文件,选择“以管理员身份运行”,运行结果如下图,最后需要键入“y”同意重启电脑,这样才能生效:

pushd "%~dp0"

dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt

for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"

del hyper-v.txt

Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL

 

检查Hyper -V安装成功然后开启Hyper -V:

(1)安装成功

 (2)开启服务(打开控制面板)

 2、问:官网(https://hub.docker.com/editions/community/docker-ce-desktop-windows/)下载了Docker的.exe文件后双击运行出现版本不匹配

       答:修改注册表(快捷键win+R,键入regedit,进入目录\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT,点击CurrentVersion,在右边找到EditionID,右击选择“修改”,将第二个选项修改成“Professional”)

此时双击运行Docker Desktop的.exe文件,第三个选项不选:

 

 3、问:在上面的运行结果中还会出现一些问题Containers Windows Feature is not available

      答:解决办法跟第1问一样,创建一个文本文件,把下面的代码复制粘贴到文件里面,然后修改文件名和后缀为改为containers.bat

pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*containers*.mum >containers.txt
for /f %%i in ('findstr /i . containers.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del containers.txt
Dism /online /enable-feature /featurename:Containers -All /LimitAccess /ALL
pause

 右击该文件,以管理员身份运行,运行截图如下,最后要重启才能生效,键入“y”电脑自动重启:

最后Docker Desktop.exe安装成功:

猜你喜欢

转载自www.cnblogs.com/BASE64/p/12821315.html