我第一次安装 Docker,当使用默认的虚拟机或者叫做“docker-machine”(不确定具体名称),遇到了以下错误:
这是一个摘录。
Checking connection to Docker...
Error creating machine: Error checking the host: Error checking and/or regenerat
ing the certs: There was an error validating certificates for host "192.168.99.1
01:2376": x509: certificate has expired or is not yet valid
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 runni
ng containers.
我尝试使用docker-machine regenerate-certs [name]
命令,它似乎可以正常工作,至少没有出现错误。但是当我尝试运行Docker的hello world命令时,得到了以下结果。
docker: error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/c
ontainers/create: open //./pipe/docker_engine: The system cannot find the file s
pecified. 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.
See 'docker run --help'.
我查找了类似的错误,并发现创建一个新的虚拟机或者docker-machine(我还不知道它该怎么称呼)解决了一些问题,但是默认虚拟机出现了同样的错误。
Error creating machine: Error checking the host: Error checking and/or regenerat
ing the certs: There was an error validating certificates for host "192.168.99.1
01:2376": x509: certificate has expired or is not yet valid
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]
接下来我尝试了 docker-machine ls
命令,以便查看是否有帮助信息。以下是输出结果。
NAME ACTIVE DRIVER STATE URL SWARM DO
CKER ERRORS
default - virtualbox Running tcp://192.168.99.100:2376 Un
known Unable to query docker version: Get https://192.168.99.100:2376/v1.15/ve
rsion: x509: certificate has expired or is not yet valid
first - virtualbox Running tcp://192.168.99.101:2376 Un
known Unable to query docker version: Get https://192.168.99.101:2376/v1.15/ve
rsion: x509: certificate has expired or is not yet valid
我该如何修复它?