Low Level Lovers

The stories of low layer programming and developments.

docker-machine regenerate-certsしても直らないとき

docker-machine env や ls を使ったときにエラーが出て、docker-machine regenerate-certsしろと言われるままにやってもうまくいかないことがある。

$ docker-machine env server1
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.1.100:2376": x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "user1")
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.

このとき、--client-certs オプションを指定してクライアント側の証明書も作り直すとうまくいく場合がある。

$ docker-machine regenerate-certs --client-certs server1
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Regenerating local 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...

2台のうち1台がこれで直りました。。。