如何在Windows 10家庭版上安装Docker
如果你曾尝试在Windows 10家庭版上安装Docker,那你一定遇到过下面这个问题:
Installation Failed: one prerequisite is not fulfilled
Docker Desktop requires Windows 10 Pro or Enterprise version 15063 to run.
在你决定花200美金购买一个Windows专业版的许可之前,先尝试下本文的做法。
安装Docker之所以需要Windows专业版或企业版,是它需要依赖Hyper-V和Containers这些专业软件。让我们开始吧。
安装Hyper-V和Containers
1、创建一个文件,命名为InstallHyperV.bat
。2、添加文件内容:
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
pause
3、在管理员权限下运行
InstallHyperV.bat
。4、再创建一个文件,命名为
InstallContainers.bat
。5、添加文件内容:
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
6、在管理员权限下运行
InstallContainers.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
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
pause
7、重启电脑。
好了,至此我们完成了Hyper-V和Containers的安装,接下来就是像在Windows专业版上一样,安装Docker了。
编辑注册表中的Windows版本
1、组合键Windows + R
然后输入regedit
。2。在注册表编辑页面,找到
\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
。3、右键点击
EditionID
,再点击修改4、修改值为
Professional
。5、单击确认
安装Docker
注意:如果重启了电脑,则EditionID
会被重置。安装前需要重新设置。万事俱备,接下来就是运行Docker安装包。这次就不应该再遇到文章开头的问题了。在安装结束后,可以再
EditionID
的值改回Core
。以上就是全部步骤了。希望你安装过程顺利,Docker能够正常运行起来。
非常感谢
hessi9
和mapk
在Docker forum提供了这个解决办法。原文链接:Install Docker on Windows 10 Home(翻译:梁斌)