未知无法查询docker版本:无法读取TLS配置:tls:无法在证书输入中找到任何PEM数据

时间:2016-10-22 05:09:35

标签: docker docker-machine

我遇到了一个奇怪的问题,我尝试在github上发布this,所以我不妨在这里问它..

➜  ~ docker-machine version
docker-machine version 0.8.2, build e18a919

➜  ~ docker-machine ls
NAME            ACTIVE   DRIVER       STATE     URL                          SWARM   DOCKER    ERRORS
atago           -        google       Running   tcp://xxx.xxx.xxx.xxx:2376           Unknown   Unable to query docker version: Unable to read TLS config: tls: failed to find any PEM data in certificate input
azure01         -        azure        Running   tcp://xxx.xx.xxx.xxx:2376            Unknown   Unable to query docker version: Unable to read TLS config: tls: failed to find any PEM data in certificate input
dev             -        virtualbox   Stopped                                        Unknown
dev01           -        google                                                      Unknown
jeanepaul-dev   -        google       Running   tcp://xxx.xxx.xxx.xx:2376            Unknown   Unable to query docker version: Unable to read TLS config: tls: failed to find any PEM data in certificate input

我尝试重新生成证书,但

➜  ~ docker-machine regenerate-certs -f azure01
Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Installing Docker...
Copying certs to the local machine directory...
error generating server cert: tls: failed to parse private key    

1 个答案:

答案 0 :(得分:1)

我尝试为Grafana设置HTTPS时遇到了相同的错误。因为它似乎是与证书有关的问题,而且很长一段时间没有回答这个问题,所以这是我在Grafana的情况下解决相同问题的方法。

1将密钥库从专有格式迁移到pkcs12格式。

keytool -importkeystore -srckeystore ./keystore -destkeystore ./keystore.pfx -deststoretype pkcs12 -storepass <storePass>

2解压缩keyStore.pem-它包括证书和密钥

openssl pkcs12 -in keystore.pfx -out keyStore.pem -nodes

3仅将密钥提取为pem格式

openssl pkcs12 -in keystore.pfx -out keyStore-keys.pem -nodes -nocerts

对于grafana,我仅使用在第2步和第3步生成的文件

vi /path/to/grafana-5.2.1/conf/custom.ini
[server]
..
cert_file = "/path/to/grafana-5.2.1/conf/keyStore.pem"
cert_key = "/path/to/grafana-5.2.1/conf/keyStore-keys.pem"