Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
boot2docker 1.7.0 cert fix
wait4eth1() {
CNT=0
until ip a show eth1 | grep -q UP
do
[ $((CNT++)) -gt 60 ] && break || sleep 1
done
sleep 1
}
wait4eth1
@garthk
Copy link
Author

garthk commented Jun 21, 2015

TL;DR:

boot2docker ssh
sudo curl -o /var/lib/boot2docker/profile https://gist.githubusercontent.com/garthk/d5a17007c277aa5c76de/raw/3d09c77aae38b4f2809d504784965f5a16f2de4c/profile
sudo halt
boot2docker up

Slower version:

Upgrading to boot2docker 1.7.0 can cause certificate errors on OS X and
Windows:

To check for and resolve the problem:

  • docker ps

  • Did it work? Congratulations! Close this browser tab.

  • Did it fail as follows? You'll need to read on:

    $ docker ps
    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
    
  • boot2docker ssh

                            ##         .
                      ## ## ##        ==
                   ## ## ## ## ##    ===
               /"""""""""""""""""\___/ ===
          ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
               \______ o           __/
                 \    \         __/
                  \____\_______/
     _                 _   ____     _            _
    | |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
    | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
    | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
    |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
    Boot2Docker version 1.7.0, build master : 7960f90 - Thu Jun 18 18:31:45 UTC 2015
    Docker version 1.7.0, build 0baf609
    docker@boot2docker:~$
    
  • sudo curl -o /var/lib/boot2docker/profile https://gist.githubusercontent.com/garthk/d5a17007c277aa5c76de/raw/3d09c77aae38b4f2809d504784965f5a16f2de4c/profile

  • sudo halt

  • boot2docker up

  • docker ps

  • Did it work? Congratulations! Close this browser tab.

WARNING: boot2docker didn't come up for me on the third run-through. I'm attributing it to the VirtualBox-inflicted kernel panics. Manual power-off and restart in VirtualBox yielded a working docker, after which boot2docker down and up did the same.

@robertd
Copy link

robertd commented Jun 22, 2015

Thanks for the workaround!

@dencold
Copy link

dencold commented Jun 22, 2015

👍 thanks so much for the workaround. 1.7.0 w/ boot2docker is now working again on my OS X machine.

@fruwe
Copy link

fruwe commented Jun 23, 2015

😄 thanks a lot
however, the first two times, I tried this, boot2docker became inaccessible.
maybe changing permissions are required?

sudo chmod +x /var/lib/boot2docker/profile

@takeit
Copy link

takeit commented Jun 23, 2015

thanks! 👍

@kayabendroth
Copy link

kayabendroth commented Jun 23, 2015

Thanks!

@adamkdean
Copy link

adamkdean commented Jun 23, 2015

Instead of this, I opted for boot2docker delete, boot2docker init, boot2docker up.

@crramirez
Copy link

crramirez commented Jun 23, 2015

Excellent article!! Happened the same to me about the WARNING. For me boot2docker delete is a pain option.

@oprearocks
Copy link

oprearocks commented Jun 23, 2015

Straight to the point! Guys, if anyone is having issues with their containers not connecting to the internet(apt-get update fails), make sure you do a clean reboot of your computer.

@Bill
Copy link

Bill commented Jun 24, 2015

Yes!

@smentek
Copy link

smentek commented Jun 24, 2015

Thanks. works after forced power off at first time

@dbartow
Copy link

dbartow commented Jun 24, 2015

Thanks! Awesome quick fix.

Copy link

ghost commented Jun 25, 2015

thanks

@MikeMitterer
Copy link

MikeMitterer commented Jun 25, 2015

Top! Thanks!

@y16ra
Copy link

y16ra commented Jun 26, 2015

In my case

$ boot2docker ssh
$ sudo /etc/init.d/docker stop
$ sudo /etc/init.d/docker start
Need TLS certs for boot2docker,127.0.0.1,10.0.2.15,192.168.59.103
-------------------
Generate server cert
/usr/local/bin/generate_cert --host=boot2docker,127.0.0.1,10.0.2.15,192.168.59.103 --ca=/var/lib/boot2docker/tls/ca.pem --ca-key=/var/lib/boot2docker/tls/cakey.pem --cert=/var/lib/boot2docker/tls/server.pem --key=/var/lib/boot2docker/tls/serverkey.pem
2015/06/26 02:49:48 Generating a server cert

it worked.

@stebunovd
Copy link

stebunovd commented Jun 29, 2015

+1 for comment above.

Original script mentioned in this gist causes my boot2docker machine to hang on start, and the only solution which remains after it is to delete it and re-init back. Instead of this I tried stopping and starting docker daemon inside boot2docker machine and it worked for me.

@pencilcheck
Copy link

pencilcheck commented Jun 29, 2015

The original script works but the boot2docker will hang on start, instead of deleting the image I force poweroff and restart and it boots right into it immediately, hooray!

@mkjsix
Copy link

mkjsix commented Jun 30, 2015

Same here: it hangs on start after applying this patch, so I forced a poweroff of the VM and then restarted successfully.
If I just run boot2docker delete, boot2docker init, boot2docker up it works but then the second time I stop and start it I again see the certificate error, while after applying this solution it disappears permanently.

@jluna79
Copy link

jluna79 commented Jul 4, 2015

After applying the proposed fix and launching boot2docker the machine would go into an indefinite wait:

Waiting for VM and Docker daemon to start.................oooooo

I had to stop, delete and recreate the VM and then followed @y16ra's comment. Everything went back to working normally.

+1

Copy link

ghost commented Jul 7, 2015

👍

@JesusLeon
Copy link

JesusLeon commented Jul 9, 2015

@adamkdean that worked for me:

boot2docker delete
boot2docker init
boot2docker up

@josephwinston
Copy link

josephwinston commented Jul 11, 2015

Thank you

@marcojonker
Copy link

marcojonker commented Jul 13, 2015

Thanks, works for me on Windows 7.

@pengswift
Copy link

pengswift commented Jul 14, 2015

@y16ra
got it, thank you.

@mildronize
Copy link

mildronize commented Jul 17, 2015

I was facing the problem as @jluna79.
Thank you for @y16ra's comment. It works for me on windows 8.1

@Elijen
Copy link

Elijen commented Aug 8, 2015

The @y16ra's comment seems to be deleted. Can anyone paste here the solution, please? My boot2docker also hangs on start

@jlucasps
Copy link

jlucasps commented Aug 9, 2015

Followed @y16ra suggestion and it worked.
(At least for now. Still don't know if I need to repeat the procedure in the future.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment