win10家庭版安装Docker for Windows

1. 开启Hyper-V

新建hyperv.cmd文件,内容如下:

pushd "%~dp0"

dir /b %SystemRoot%servicingPackages*Hyper-V*.mum >hyper-v.txt

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

del hyper-v.txt

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

以管理员身份执行hyperv.cmd文件,然后重启

重启成功后,打开Hyper-V

2. 伪装成win10专业版

以管理员身份打开cmd,执行如下命令:

REG ADD "HKEY_LOCAL_MACHINEsoftwareMicrosoftWindows NTCurrentVersion" /v EditionId /T REG_EXPAND_SZ /d Professional /F

3. 下载Docker for Windows

 官网下载

4、安装可能遇到的问题

安装过程中可能会以下报错

Containers Windows Feature is not available
   在 CommunityInstaller.EnableFeaturesAction.GetFeaturesToEnable()
   在 CommunityInstaller.EnableFeaturesAction.<DoAsync>d__29.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 CommunityInstaller.InstallWorkflow.<HandleD4WPackageAsync>d__29.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 CommunityInstaller.InstallWorkflow.<ProcessAsync>d__24.MoveNext()

解决方法:

将以下代码保存为批处理文件,然后管理员运行,重启、安装。

pushd "%~dp0"
dir /b %SystemRoot%servicingPackages*containers*.mum >containers.txt
for /f %%i in ('findstr /i . containers.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%servicingPackages\%%i"
del containers.txt
Dism /online /enable-feature /featurename:Containers -All /LimitAccess /ALL
pause
原文地址:https://www.cnblogs.com/liguix/p/12382089.html