the industrial

ブログと言うより自分のためのメモ以外の何モノでもないです。でも読んでくださってありがとうございます。

Dockerの環境構築で"Please check your TLS client certification settings"とかいうエラーが出た話

最近Dockerが楽しいっす。

いろいろやりたいことがあって、でもまあとりあえず学習がてらcontainerを幾つか作り、ローカルでいろんなアプリを動かしたいなと。

Dockerの環境構築には、昨今のDocker界隈における定石通り、Docker Toolbox | Dockerを使っている。

しかし、ちょっと前の話なのだけど、環境構築1発目で下記のエラーが出てどうにも何もできなかったのだけど、なんとか解決(というか回避)できたのでメモって置く。

$ docker images
The server probably has client authentication (--tlsverify) enabled. Please check your TLS client certification settings: Get https://192.168.99.100:2376/v1.23/images/json: remote error: bad certificate

Dockerを動かしているdocker-machineはちゃんと動いているし、いろいろ調べてもなんかよくわからなくてネー。

$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
default   *        virtualbox   Running   tcp://192.168.99.100:2376           v1.11.2

そんで気づいたのが、docker-machineの上記ログにはv1.11.2と表示されていて、エラーログにはv1.23なる文字が。

そこで思い出したのだけど、以前Boot2docker by boot2dockerを使ったことがあって、その時に作成された~/.dockerディレクトがそのままだったからっぽい。

なので、一度dockertoolboxをアンインストールし、~/.dockerディレクトリを削除。

再度dockertoolboxをインストールして、docker-machine create --driver virtualbox defaultをしたら、docker使えるようになった。↓

$ docker-machine create --driver virtualbox default
Creating CA: /Users/omi-swordfish/.docker/machine/certs/ca.pem
Creating client certificate: /Users/omi-swordfish/.docker/machine/certs/cert.pem
Running pre-create checks...
(default) Default Boot2Docker ISO is out-of-date, downloading the latest release...
(default) Latest release for github.com/boot2docker/boot2docker is v1.11.2
(default) Downloading /Users/omi-swordfish/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v1.11.2/boot2docker.iso...
(default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(default) Copying /Users/omi-swordfish/.docker/machine/cache/boot2docker.iso to /Users/omi-swordfish/.docker/machine/machines/default/boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env default
$ docker pull centos:centos6
centos6: Pulling from library/centos
a3ed95caeb02: Pull complete
66b316858002: Pull complete
Digest: sha256:3ab2eb5d99ab627350104e476daefcee5ef363b03ffcf2764ba01caddc0ccfd1
Status: Downloaded newer image for centos:centos6
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              centos6             6a77ab6655b9        19 hours ago        194.6 MB

素敵なDockerlifeを!w