久しぶりにdocker-machineを使おうとしたら、証明書の再作成だけでは解決できなかった。
docker-machineを起動したら、証明書は再作成
docker-machineを起動させた場合、たいていは証明書の再作成を求められる。
$ docker-machine env dev
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100: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 running containers.
$
このように、証明書の期限が切れたので再作成するようにと言われ、素直に再作成すれば解決する。
$ docker-machine regenerate-certs dev
Regenerate TLS machine certs?Ð Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
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-machineを動かしたところ、証明書の再作成だけではエラーが解消しなかった。
で、ググってたどり着いたstackoverflowに解決方法が。
Attention Required! | Cloudflare
デフォルトではクライアント証明書は再作成されないので、–cert-clientオプションをつけて再作成しろとのこと。
Docker Desktopが使えない環境ではdocker-machineは現役
Docker Desktopを使え!というのはもっともな話。でも、それがサポートしていないOSで開発しなければならない職場環境というのもあるわけで。
コメント