简单的docker命令不起作用:x509:无法验证证书

时间:2016-06-03 08:40:18

标签: docker

您好我只是安装了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'.

非常感谢任何回复。

1 个答案:

答案 0 :(得分:0)

原因是我支持公司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

有关解释,请访问here

感谢你的建议,vitr