Docker 教程
win7、win8 等需要利用 docker toolbox 來(lái)安裝,國(guó)內(nèi)可以使用阿里云的鏡像來(lái)下載,下載地址:http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/
安裝比較簡(jiǎn)單,雙擊運(yùn)行,點(diǎn)下一步即可,可以勾選自己需要的組件:
docker toolbox 是一個(gè)工具集,它主要包含以下一些內(nèi)容:
下載完成之后直接點(diǎn)擊安裝,安裝成功后,桌邊會(huì)出現(xiàn)三個(gè)圖標(biāo),如下圖所示:
點(diǎn)擊 Docker QuickStart 圖標(biāo)來(lái)啟動(dòng) Docker Toolbox 終端。
如果系統(tǒng)顯示 User Account Control 窗口來(lái)運(yùn)行 VirtualBox 修改你的電腦,選擇 Yes。
$ 符號(hào)那你可以輸入以下命令來(lái)執(zhí)行。
$ 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/
現(xiàn)在 Docker 有專門的 Win10 專業(yè)版系統(tǒng)的安裝包,需要開啟 Hyper-V。
程序和功能
啟用或關(guān)閉Windows功能
最新版 Toolbox?下載地址: 訪問(wèn) https://www.docker.com/get-started,注冊(cè)一個(gè)賬號(hào),然后登錄。
點(diǎn)擊 Get started with Docker Desktop,并下載 Windows 的版本,如果你還沒(méi)有登錄,會(huì)要求注冊(cè)登錄:
雙擊下載的 Docker for Windows Installer 安裝文件,一路 Next,點(diǎn)擊 Finish 完成安裝。
安裝完成后,Docker 會(huì)自動(dòng)啟動(dòng)。通知欄上會(huì)出現(xiàn)個(gè)小鯨魚的圖標(biāo),這表示 Docker 正在運(yùn)行。
桌邊也會(huì)出現(xiàn)三個(gè)圖標(biāo),入下圖所示:
我們可以在命令行執(zhí)行 docker version 來(lái)查看版本號(hào),docker run hello-world 來(lái)載入測(cè)試鏡像測(cè)試。
如果沒(méi)啟動(dòng),你可以在 Windows 搜索 Docker 來(lái)啟動(dòng):
啟動(dòng)后,也可以在通知欄上看到小鯨魚圖標(biāo):
對(duì)于使用 Windows 10 的系統(tǒng),在系統(tǒng)右下角托盤 Docker 圖標(biāo)內(nèi)右鍵菜單選擇 Settings,打開配置窗口后左側(cè)導(dǎo)航菜單選擇 Daemon。在 Registrymirrors 一欄中填寫加速器地址 https://registry.docker-cn.com ,之后點(diǎn)擊 Apply 保存后 Docker 就會(huì)重啟并應(yīng)用配置的鏡像地址了。