簡體   English   中英

簡單的docker命令不起作用:x509:無法驗證證書

[英]Simple docker command does not work: x509: cannot validate certificate

嗨,我只是安裝docker我打開cmd並創建一個默認的docker機器:

C:\git>docker-machine create --driver virtualbox default
Running pre-create checks...
Creating machine...
(default) Copying C:\Users\NGT1IMB\.docker\machine\cache\boot2docker.iso to C:\Users\NGT1IMB\.docker\machine\machines\default\boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env default

C:\git>docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
default   *        virtualbox   Running   tcp://192.168.99.100:2376           v1.11.2

C:\git>docker-machine env default
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:\Users\NGT1IMB\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i

然后我在嘗試按照教程時遇到此錯誤:

C:\git>docker run hello-world
docker: An error occurred trying to connect: Post https://192.168.99.100:2376/v1.23/containers/create: x509: cannot vali
date certificate for 192.168.99.100 because it doesn't contain any IP SANs.
See 'docker run --help'.

任何回復都非常感謝。

原因是我支持NLTM代理公司。 因此,在創建默認VM時,我必須設置代理:

docker-machine create -d virtualbox --engine-env HTTP_PROXY=http://<host>.<port> -engine-env HTTPS_PROXY=https://<host>.<port> default

此外,我使用CNTLM通過localhost:3128設置本地代理。 默認VM在具有NAT設置的Virtualbox上運行。 所以我需要設置

HTTP_PROXY=http://192.168.99.1:3128

有關解釋,請訪問此處

謝謝你的建議,玻璃

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM