繁体   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