boot2docker / osx-installer

Docker installer for Mac OS X
Apache License 2.0
1.25k stars 258 forks source link

Invalid certificate error connecting to docker host #115

Closed aburnett closed 9 years ago

aburnett commented 9 years ago

After running a boot2docker upgrade to upgrade to 1.7 I am now getting the following whenever I try and run docker. I deleted my ~/.boot2docker directory, VM, /Applications/boot2docker and reinstalled from scratch, but still the same error.

An error occurred trying to connect: Get https://192.168.59.103:2376/v1.19/containers/json: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103
zedesk commented 9 years ago

I already have this problem, the workaround I found is to delete certificates

boot2docker ssh

sudo rm -f /var/lib/boot2docker/tls/serverkey.pem sudo rm -f /var/lib/boot2docker/tls/server.pem sudo /etc/init.d/docker stop sudo /etc/init.d/docker start

this will force boot2docker to regenerate certificates

On Wed, Jun 24, 2015 at 3:48 AM, Adam Burnett notifications@github.com wrote:

After running a boot2docker upgrade to upgrade to 1.7 I am now getting the following whenever I try and run docker. I deleted my ~/.boot2docker directory, VM, /Applications/boot2docker and reinstalled from scratch, but still the same error.

An error occurred trying to connect: Get https://192.168.59.103:2376/v1.19/containers/json: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103

— Reply to this email directly or view it on GitHub https://github.com/boot2docker/osx-installer/issues/115.

aburnett commented 9 years ago

That almost worked. It worked immediately, but the next time the boot2docker vm itself was restarted it came back.

aburnett commented 9 years ago

This looks like a possible timing issue in the boot2docker VM itself. During startup the 192 interface isn't up when docker is started. I modified /etc/init.d/boot2docker to print the output of ifconfig during startup and this is what I see.

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
   valid_lft forever preferred_lft forever
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default 
    link/ether 3e:8b:d2:d2:5d:ec brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:fe:88:a1 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fefe:88a1/64 scope link tentative 
       valid_lft forever preferred_lft forever
4: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 08:00:27:6a:7f:44 brd ff:ff:ff:ff:ff:ff
-------------------
Need TLS certs for boot2docker,127.0.0.1,10.0.2.15
-------------------
aburnett commented 9 years ago

Reposted to the boot2docker project as this doesn't seem to be specific to the OSX installer.