1. 通过bat脚本安装 Hyper-V
:: Hyper-V-install.bat
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
2. 通过bat脚本安装Container
:: Container-install.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
3. 修改注册表 Win+r regedit.exe
- 手工修改 "HKEY_LOCAL_MACHINE\software\Microsoft\Windows NT\CurrentVersion" 的 EditionId 项为
Professional
;
- 通过bat脚本修改, 重启之后会回复到设置前状态.
:: 因为注册表具体项和系统版本有关. 建议手工修改. 如果使用脚本, 尝试上使用以下2条命令行语句. 因为我的windows 用第二行命令, 所以第一行命令注释掉了.
:: REG ADD "HKEY_LOCAL_MACHINE\software\Microsoft\Windows NT\CurrentVersion" /v EditionId /T REG_EXPAND_SZ /d Professional /F
REG ADD "HKEY_LOCAL_MACHINE\software\Microsoft\Windows NT\CurrentVersion" /v EditionId /T REG_SZ /d Professional /F
4. 下载Docker desktop for windows 安装
Docker desktop for Windows链接
安装步骤
网友评论