iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 5
0
自我挑戰組

30天菜鳥學 Linux 系列 第 5

5天-搞清楚為何 WSL2 需不需要 Windows Docker Desktop

今天讀完了 鳥哥的 Linux 私房菜 -- 第七章、Linux 磁碟與檔案系統管理


另外今天問了以下問題,感覺快變成學習 WSL 系列了 XD o(≧口≦)o
在IT幫 :

WSL2 擁有 Linux 內核 , 為何安裝 docker 還需要 Windows Docker Desktop?

會有這個疑惑是 :

查看很多網路上的文章,很多還是教 WSL2 安裝 docker 需要使用 Windows Docker Desktop

舉例 :

但 WSL2 不是標榜已經擁有 Linux Core , 為何還要依賴於 windows 環境的 docker desktop

並且也有安裝 docker 不依賴 windwos docker desktop 的方式

以關鍵字 「WSL2 擁有 Linux 內核 , 為何安裝 docker 還需要 Windows Docker Desktop?」 搜尋 google 前三頁,沒看到有人講到核心的Why

得到回答 :

這應該有誤會吧,基本上安裝windows 版 docker 只需要 VirtualMachinePlatform 、microsoft-hyper-v

而wsl 則需要另外安裝Microsoft-Windows-Subsystem-Linux
而windows core 則需要安裝 Containers

若是要安裝wsl2 則於外需要另外安裝 wsl2kernel 元件

所以你若不需要使用 windows core環境的docker ,就不用安裝Containers 等套件,就可以很單純使用 linux core的docker環境。


接著在思否跟SuperUser也問同樣問題,得到了解答
后端 - WSL2 拥有 Linux 内核 , 为何安装 docker 还需要 Windows Docker Desktop? - SegmentFault 思否

Windows Docker Desktop 比直接在 WSL2 装 Docker 的优点是能更好的跟你的工具集成,比如 IDE、PowerShell、cmd之类的东西,但是其它就没有区别。

Does WSL2 docker need windows docker desktop? - Super User

Docker Desktop provides out-of-the-box integration with Windows like the docker CLI and folder mappings.

You do not need Docker Desktop if you don’t want these. You’re not looking at the Docker engine documentation but at the Docker Desktop documentation. WSL 2 is just Linux, so you can install any Linux software (that doesn’t have special hardware or exotic kernel feature requirements).

You can also set up the docker CLI manually, if desired, using DOCKER_HOST… environment variables.

總結 :
因為有了Linux Core 所以 Windows Docker Desktop 可以不需要
但跟 Windows 特有的 IDE、PowerShell 整合就會差一點 , 但也少一點坑 (!? XD)


上一篇
4天-哎呀,被 WSL2 坑一把 ╰(艹皿艹 )
下一篇
6天-WSL2安裝MySQL
系列文
30天菜鳥學 Linux 59
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 則留言

1
screenleon
iT邦新手 1 級 ‧ 2020-09-09 10:01:01

我是使用vscode搭配wsl2進行開發 覺得兩者使用上還蠻方便的

wsl2 code . 讚!

harryx001 iT邦新手 5 級 ‧ 2023-04-15 11:24:41 檢舉

您好,是否有相關的教學文檔可參考?
我的電腦從來沒裝過linux, docker等(純windows),現在因工作需求需要跑airflow,打算用windows的WSL2(我的IDE也是VS Code),安裝docker,再在上面跑airflow。
有看到這篇,但看來仍需安裝Ubuntu之類的?

謝謝

我要留言

立即登入留言