如果你曾尝试在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(https://forums.docker.com/t/installing-docker-on-windows-10-home/11722/28)提供了这个解决办法。
原文链接:https://itnext.io/install-docker-on-windows-10-home-d8e621997c1d
Kubernetes实战培训
Kubernetes实战培训将于2020年12月25日在深圳开课,3天时间带你系统掌握Kubernetes,学习效果不好可以继续学习。本次培训包括:云原生介绍、微服务;Docker基础、Docker工作原理、镜像、网络、存储、数据卷、安全;Kubernetes架构、核心组件、常用对象、网络、存储、认证、服务发现、调度和服务质量保证、日志、监控、告警、Helm、实践案例等,点击下方图片或者阅读原文链接查看详情。