[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

JIAN2發表於2021-09-10

Windows Docker 安裝

Docker 並非是一個通用的容器工具,它依賴於已存在並執行的 Linux 核心環境。

Docker 實質上是在已經執行的 Linux 下製造了一個隔離的檔案環境,因此它執行的效率幾乎等同於所部署的 Linux 主機。

因此,Docker 必須部署在 Linux 核心的系統上。如果其他系統想部署 Docker 就必須安裝一個虛擬 Linux 環境。

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

在 Windows 上部署 Docker 的方法都是先安裝一個虛擬機器,並在安裝 Linux 系統的的虛擬機器中執行 Docker。

Win10 系統

Docker Desktop 是 Docker 在 Windows 10 和 macOS 作業系統上的官方安裝方式,這個方法依然屬於先在虛擬機器中安裝 Linux 然後再安裝 Docker 的方法。

Docker Desktop 官方下載地址: 

注意:此方法僅適用於 Windows 10 作業系統專業版、企業版、教育版和部分家庭版!

安裝 Hyper-V

Hyper-V 是微軟開發的虛擬機器,類似於 VMWare 或 VirtualBox,僅適用於 Windows 10。這是 Docker Desktop for Windows 所使用的虛擬機器。

但是,這個虛擬機器一旦啟用,QEMU、VirtualBox 或 VMWare Workstation 15 及以下版本將無法使用!如果你必須在電腦上使用其他虛擬機器(例如開發 Android 應用必須使用的模擬器),請不要使用 Hyper-V!

開啟 Hyper-V

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

程式和功能

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

啟用或關閉Windows功能

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

選中Hyper-V

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

也可以透過命令來啟用 Hyper-V ,請右鍵開始選單並以管理員身份執行 PowerShell,執行以下命令:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

安裝 Docker Desktop for Windows

點選  ,並下載 Windows 的版本,如果你還沒有登入,會要求註冊登入:

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

執行安裝檔案

雙擊下載的 Docker for Windows Installer 安裝檔案,一路 Next,點選 Finish 完成安裝。

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

安裝完成後,Docker 會自動啟動。通知欄上會出現個小鯨魚的圖示 [第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結,這表示 Docker 正在執行。

桌邊也會出現三個圖示,如下圖所示:

我們可以在命令列執行 docker version 來檢視版本號,docker run hello-world 來載入測試映象測試。

如果沒啟動,你可以在 Windows 搜尋 Docker 來啟動:

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

啟動後,也可以在通知欄上看到小鯨魚圖示:

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

如果啟動中遇到因 WSL 2 導致地錯誤,請安裝  。

安裝之後,可以開啟 PowerShell 並執行以下命令檢測是否執行成功:

docker run hello-world

在成功執行之後應該會出現以下資訊:

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結


win7、win8 系統

win7、win8 等需要利用 docker toolbox 來安裝,國內可以使用阿里雲的映象來下載,下載地址:

安裝比較簡單,雙擊執行,點下一步即可,可以勾選自己需要的元件:

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

docker toolbox 是一個工具集,它主要包含以下一些內容:

  • Docker CLI - 客戶端,用來執行 docker 引擎建立映象和容器。
  • Docker Machine - 可以讓你在 Windows 的命令列中執行 docker 引擎命令。
  • Docker Compose - 用來執行 docker-compose 命令。
  • Kitematic - 這是 Docker 的 GUI 版本。
  • Docker QuickStart shell - 這是一個已經配置好Docker的命令列環境。
  • Oracle VM Virtualbox - 虛擬機器。

下載完成之後直接點選安裝,安裝成功後,桌邊會出現三個圖示,如下圖所示:

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

點選 Docker QuickStart 圖示來啟動 Docker Toolbox 終端。

如果系統顯示 User Account Control 視窗來執行 VirtualBox 修改你的電腦,選擇 Yes。

[第四篇]——Windows Docker 安裝之Spring Cloud直播商城 b2b2c電子商務技術總結

$ 符號那你可以輸入以下命令來執行。

$ docker run hello-world Unable to find image 'hello-world:latest' locally Pulling repository hello-world 91c95931e552: Download complete
 a8219747be10: Download complete Status: Downloaded newer image for hello-world:latest Hello from Docker.
 This message shows that your installation appears to be working correctly.
 To generate this message, Docker took the following steps:
  1. The Docker Engine CLI client contacted the Docker Engine daemon.
  2. The Docker Engine daemon pulled the "hello-world" image from the Docker Hub.
     (Assuming it was not already locally available.)
  3. The Docker Engine daemon created a new container from that image which runs the
     executable that produces the output you are currently reading.
  4. The Docker Engine daemon streamed that output to the Docker Engine CLI client, which sent it
     to your terminal.
 To try something more ambitious, you can run an Ubuntu container with:
  $ docker run -it ubuntu bash For more examples and ideas, visit:


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70006413/viewspace-2791376/,如需轉載,請註明出處,否則將追究法律責任。

相關文章