LoginSignup
2
0

More than 3 years have passed since last update.

Winodows+DockerToolBoxで証明書の期限が切れてDockerに接続できない

Posted at

普段から利用しているDockerでSSL関連でDockerコマンドが動作しなくなる問題が発生したため、解消の手順をメモしています。

$ docker-compose up -d
ERROR: SSL error: HTTPSConnectionPool(host='192.168.99.100', port=2376): Max retries exceeded with url: /v1.38/networks/scalaakkapractice_default (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))
$ docker ps
error during connect: Get https://192.168.99.100:2376/v1.40/containers/json: x509: certificate has expired or is not yet valid

調べてところDockerに接続する部分のSSL証明書の有効期限が切れているようだったので証明書の有効期限を確認する。

$ openssl x509 -noout -dates -in ~/.docker/machine/certs/ca.pem 
notBefore=Mar 14 14:09:00 2017 GMT
notAfter=Feb 27 14:09:00 2020 GMT

2020/2/27で期限切れとなっていたので証明書を更新する。
(DockerToolBoxのデフォルトのmachine名はdefaultです)

$ docker-machine regenerate-certs --client-certs default
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y

Regenerating TLS certificates
Regenerating local certificates
CA certificate is outdated and needs to be regenerated
Creating CA: C:\Users\shinohara\.docker\machine\certs\ca.pem
Client certificate is outdated and needs to be regenerated
Creating client certificate: C:\Users\shinohara\.docker\machine\certs\cert.pem
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...

証明書を更新すると、Dockerコマンドが動くようになった。

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0