目錄
前提條件
需要Windows功能:
Hyper-V打開控制面板 - 程序和功能 - 啓用或關閉Windows功能,勾選Hyper-V,然後點擊確定即可,如圖:
點擊確定後,啓用完畢會提示重啓系統,我們可以稍後再重啓。
很遺憾我是家庭版...沒有Hyper-V,難受,並不想換系統~
======================
排錯1:
解決:家庭版添加Hyper-V
新建文件hyper-V.cmd將以下內容copy到裏面:
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
保存後右鍵使用管理員權限運行
等待安裝完成,輸入Y自動重啓電腦即可。
完成安裝後,就可以使用了,點擊確定即可。
==========================
下載並運行安裝程序
Docker下載地址爲:https://store.docker.com/editions/community/docker-ce-desktop-windows 點擊如圖處即可下載安裝包:
==========================
排錯2:
運行安裝程序,但是報錯:
Docker Desktop requires Windows 10 Pro or Enterprise version 15063 to run
意思是安裝docker必須要win10專業版,我不信邪~
===========================
但是 docker 要查系統版本號怎麼辦?那就騙它。
打開註冊表編輯器,找到下圖所示的 EditionID:
把數值數據改成 Professional,瞞天過海
再次安裝 docker,成功運行 √
===============================
排錯3:
但是有報錯:
Containers Windows Feature is not available
意思是容器窗口功能不可用
新建一個containers.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
保存後右鍵使用管理員權限運行
同理等待運行完成,輸入Y重啓電腦
再次安裝 docker,成功運行 √
===============================
注意點:
記得勾選 use windows containers instead of linux containers(使用 windows 容器而不是 linux 容器)
==============================
親測完美運行
運行docker
雙擊可愛的小圖標
會提示註冊:
去官網註冊下就好了:
配置鏡像加速:
設置如下,apply&restart即可。
==========================
測試下吧~
cmd窗口打開
輸入 docker --version
成功安裝
至此,踩踩坑的docker安裝完畢,嗷嗷嗷!!!撒花✿✿ヽ(°▽°)ノ✿
====================================
ps:docker 提示image operating system "linux" cannot be used on this platform
切換下系統即可: