如果你曾嘗試在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、實踐案例等,點擊下方圖片或者閱讀原文鏈接查看詳情。