Windows Docker 安裝
win7、win8 系統
win7、win8 等需要利用 docker toolbox 來安裝,國內可以使用阿裏雲的鏡像來下載,下載地址:http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/
安裝比較簡單,雙擊運行,點下一步即可,可以勾選自己需要的組件:
docker toolbox 是一個工具集,它主要包含以下一些內容:
- Docker CLI - 客戶端,用來運行 docker 引擎創建鏡像和容器。
- Docker Machine - 可以讓你在 Windows 的命令行中運行 docker 引擎命令。
- Docker Compose - 用來運行 docker-compose 命令。
- Kitematic - 這是 Docker 的 GUI 版本。
- Docker QuickStart shell - 這是一個已經配置好Docker的命令行環境。
- Oracle VM Virtualbox - 虛擬機。
下載完成之後直接點擊安裝,安裝成功後,桌邊會出現三個圖示,入下圖所示:
點擊 Docker QuickStart 圖示來啟動 Docker Toolbox 終端。
如果系統顯示 User Account Control 窗口來運行 VirtualBox 修改你的電腦,選擇 Yes。
$ 符號那你可以輸入以下命令來執行。
$ 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: https://docs.docker.com/userguide/
Win10 系統
現在 Docker 有專門的 Win10 專業版系統的安裝包,需要開啟Hyper-V。
開啟 Hyper-V
程式和功能
啟用或關閉Windows功能
1、安裝 Toolbox
最新版 Toolbox 下載地址: https://www.docker.com/get-docker
點擊 Download Desktop and Take a Tutorial,並下載 Windows 的版本,如果你還沒有登錄,會要求註冊登錄:
2、運行安裝檔
雙擊下載的 Docker for Windows Installer 安裝檔,一路 Next,點擊 Finish 完成安裝。
安裝完成後,Docker 會自動啟動。通知欄上會出現個小鯨魚的圖示,這表示 Docker 正在運行。
桌邊也會出現三個圖示,入下圖所示:
我們可以在命令行執行 docker version 來查看版本號,docker run hello-world 來載入測試鏡像測試。
如果沒啟動,你可以在 Windows 搜索 Docker 來啟動:
啟動後,也可以在通知欄上看到小鯨魚圖示:
鏡像加速
Windows 10
對於使用 Windows 10 的系統,在系統右下角託盤 Docker 圖示內右鍵菜單選擇 Settings,打開配置窗口後左側導航菜單選擇 Daemon。在 Registrymirrors 一欄中填寫加速器地址 https://registry.docker-cn.com ,之後點擊 Apply 保存後 Docker 就會重啟並應用配置的鏡像地址了。