1. 程式人生 > WINDOWS開發 >windows docker安裝

windows docker安裝

https://docs.microsoft.com/zh-cn/virtualization/windowscontainers/manage-docker/configure-docker-daemon

boot2docker 下載地址

https://github.com/boot2docker/boot2docker/releases

Docker-Machine 下載地址

http://github.com/docker/machine/releases

配置項
C:\ProgramData\docker\config

https://docs.microsoft.com/zh-cn/virtualization/windowscontainers/manage-docker/configure-docker-daemon

--設定配置
sc config docker binpath= ""C:\Program Files\docker\dockerd.exe" --run-service -H tcp://0.0.0.0:2375"

sc config docker binpath= ""C:\Program Files\docker\dockerd.exe" --data-root "F:\SoftTool\Docker\data-root"

sc config docker binpath= ""C:\Program Files\docker\dockerd.exe" --experimental true

windows 安裝docker 安裝說明 使用 virtualbox 虛擬機器
https://www.cnblogs.com/52fhy/p/8413029.html
預設使用者名稱是docker,密碼tcuser

安裝說明 hyperv-virtual-switch
https://www.linuxidc.com/Linux/2017-02/141062.htm

1、登入到 虛擬機器的docker環境

cmd cd到 docker-machine 目錄下
docker-machine ssh vm8
powerShell 環境
登入到docker虛擬機器環境 PS F:\SoftTool\Docker\docker-machine\v0.16.2>.\docker-machine ssh vm8

2、共享目錄 F:\SoftTool\Docker\data-root 到容器虛擬機器中

docker run -it -v F:\SoftTool\Docker\data-root :\test alpine sh

建立Docker machine
在管理員cmd環境裡進入到docker-machine.exe所在的資料夾
執行命令的格式如下:
docker-machine create -d hyperv --hyperv-virtual-switch ""

安裝命令
docker-machine create -d hyperv --hyperv-virtual-switch "DockNAT" VM8
把當前主機設定為預設docker命令執行的主機,根據提示,我們執行下面命令

docker-machine.exe env VM8
執行命令: @FOR /f "tokens=*" %i IN (‘docker-machine env vm8‘) DO @%i

完成後,執行命令: docker version 檢視主機資訊

重新生成我的證書命令:
docker-machine regenerate-certs VM8 --VM8虛擬機器名稱

主機重啟ip地址修改後
錯誤提示 :
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows,the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
(連線期間出錯:獲取http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/version:開啟//.//pipe/docker_engine:系統找不到指定的檔案。 在Windows上的預設守護程式配置中,必須將docker客戶端提升執行以進行連線。 該錯誤也可能表明docker守護程式未執行)

解決辦法:
跳轉到 docker-machine.exe目錄下 cd F:\SoftTool\Docker\docker-machine\v0.16.2
輸入命令 docker-machine env VM8
錯誤提示:
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.10.194:2376": x509: certificate is valid for 192.168.8.110,not 192.168.10.194
You can attempt to regenerate them using ‘docker-machine regenerate-certs [name]‘.
Be advised that this will trigger a Docker daemon restart which might stop running containers.
(檢查TLS連線時出錯:檢查和/或重新生成證書時出錯:驗證主機“ 192.168.10.194:2376”的證書時出錯:x509:證書對192.168.8.110有效,而不對192.168.10.194有效
您可以嘗試使用“ docker-machine regenerate-certs [name]”來重新生成它們。)

重新生成證書命令: F:\SoftTool\Docker\docker-machine\v0.16.2>docker-machine regenerate-certs VM8

Regenerate TLS machine certs? Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...

選擇y
正常會 重新生成證書

輸入命令 docker version 檢視 正常顯示