Monday, March 28, 2016

Error checking TLS connection: Error checking and/or regenerating the certs

Leave a Comment

After I restarted my windows i cannot connect to docker machine running in Oracle Virtual Box. When i start Docker QuickStart Terminal every thing looks fine, it's coming up OK and it gives me this message:

docker is configured to use the default machine with IP 192.168.99.100 For help getting started, check out the docs at https://docs.docker.com 

but when i do:

$ docker-machine ls NAME      ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER   ERRORS default   -        virtualbox   Timeout 

and:

λ docker images An error occurred trying to connect: Get http://localhost:2375/v1.21/images/json: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it. 

also when i try to reinitialize my env., i get:

λ docker-machine env default Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": dial tcp 192.168.99.100:2376: i/o timeout You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'. Be advised that this will trigger a Docker daemon restart which will stop running containers. 

BTW, Regenerating certs also not helping. Any idea?

Thanks.

5 Answers

Answers 1

After doing some research I found out that following workaround may solve the issue for now:

  1. Open Network And Sharing Center
  2. Click on Change Adapter Setting
  3. See if you have any enabled adapters such as VPN or VM Ware network adapters.
  4. Try to disable them and try to connect to your container one more time
  5. If it didn't work while you have other adapters disabled, Restart your PC - in my case this worked for me.

I'll try to find a permanent solution, any idea appreciated.

Thanks in advance.

Answers 2

Please try regenerating certificates manually by:

docker-machine --debug regenerate-certs -f default 

and check for any errors to fix, then try again:

docker-machine --debug env default 

If it's failing on ssh, copy and paste that command into terminal to see what's the problem by adding extra -vv.

If you've got:

debug1: connect to address 127.0.0.1 port 64368: Connection refused

then your machine isn't running (check by docker-machine ls), so try:

docker-machine start 

Then try to ssh to it via:

docker-machine -D ssh default 

Answers 3

The way I ensure being able to connect to my docker machines is by assigning them a fixed IP (and regenerating the certs only once) (no reboot needed)

After that, docker-machine ls always work.

My current script:
(replace %PRGS%\dm\latest by the path where docker-machine.exe is on your machine)
(make sure PATH include the latest /path/to/git/usr/bin, for commands like ssh to be available)

> more dmvbf.bat @echo off setlocal enabledelayedexpansion set machine=%1 if "%machine%" == "" (         echo dmvbf expects a machine name         exit /b 1 ) set ipx=%2 if "%ipx%" == "" (         echo dmvbf x missing ^(for 192.168.x.y^)         exit /b 2 ) set ipy=%3 if "%ipy%" == "" (         echo dmvbf y missing ^(for 192.168.x.y^)         exit /b 3 )  %PRGS%\dm\latest\docker-machine.exe ssh %machine% "sudo sh -c 'echo \"kill \$(more /var/run/udhcpc.eth1.pid)\" | sudo tee /var/lib/boot2docker/bootsync.sh >/dev/null'" %PRGS%\dm\latest\docker-machine ssh %machine% "sudo sh -c 'echo \"ifconfig eth1 192.168.%ipx%.%ipy% netmask 255.255.255.0 broadcast 192.168.%ipx%.255 up\" | sudo tee -a /var/lib/boot2docker/bootsync.sh >/dev/null'"  %PRGS%\dm\latest\docker-machine ssh %machine% "sudo chmod 755 /var/lib/boot2docker/bootsync.sh"  %PRGS%\dm\latest\docker-machine ssh %machine% "sudo cat /var/run/udhcpc.eth1.pid | xargs sudo kill"  %PRGS%\dm\latest\docker-machine ssh %machine% "sudo ifconfig eth1 192.168.%ipx%.%ipy% netmask 255.255.255.0 broadcast 192.168.%ipx%.255 up" 

For instance:

dmvbf default 99 100 docker-machine regenerate-certs -f default 

That will assign 192.168.99.100 to the docker machine 'default', and regenerate the certs once.
Then each time docker-machine ls is called, it will display the same IP for 'default'.

Answers 4

I am having a similar problem. Any direction would help. The "docker-machine -D ssh default" Allows me to login and work the container. but it still bugs me as to why do I see this error?

Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon...

This machine has been allocated an IP address, but Docker Machine could not reach it successfully.

SSH for the machine should still work, but connecting to exposed ports, such as the Docker daemon port (usually :2376), may not work properly.

You may need to add the route manually, or use another related workaround.

This could be due to a VPN, proxy, or host file configuration issue.

You also might want to clear any VirtualBox host only interfaces you are not using. Checking connection to Docker... Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": dial tcp 192.168.99.100:2376: i/o timeout You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'. Be advised that this will trigger a Docker daemon restart which will stop running containers.

Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": dial tcp 192.168.99.100:2376: i/o timeout You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'. Be advised that this will trigger a Docker daemon restart which will stop running containers.

docker is configured to use the default machine with IP 192.168.99.100 For help getting started, check out the docs at https://docs.docker.com

$ docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default virtualbox Timeout
$docker-machine -D ssh default Docker Machine Version: 0.6.0, build e27fb87 Found binary path at /usr/local/bin/docker-machine Launching plugin server for driver virtualbox Plugin server listening at address 127.0.0.1:50515 () Calling .GetVersion . .

.

$docker-machine regenerate-certs -f default 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...

This machine has been allocated an IP address, but Docker Machine could not reach it successfully.

SSH for the machine should still work, but connecting to exposed ports, such as the Docker daemon port (usually :2376), may not work properly.

You may need to add the route manually, or use another related workaround.

This could be due to a VPN, proxy, or host file configuration issue.

You also might want to clear any VirtualBox host only interfaces you are not using. $

Answers 5

Here is what worked for me. The first steps are similar to what Hazhir proposed, then followed by regenerate the certificates.

  1. Open Network And Sharing Center.
  2. Click on Change Adapter Setting.
  3. Disable all active VMWare network adapters. Usually has explanation "VirtualBox Host-Only Ethernet Adapter".
  4. Connect to your container by running docker-machine start.
  5. Run docker-machine env. If you're like me then you'd get following error:

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 is valid for 192.168.99.101, not 192.168.99.100

Which is good. Now all we need to do is to run

docker-machine regenerate-certs -f default 

Then test it again with docker-machine env. If you get:

SET DOCKER_TLS_VERIFY=1 SET DOCKER_HOST=tcp://192.168.99.100:2376 SET DOCKER_CERT_PATH=C:\Users\Jay\.docker\machine\machines\default SET DOCKER_MACHINE_NAME=default REM Run this command to configure your shell: REM     FOR /f "tokens=*" %i IN ('docker-machine env') DO %i 

Then you're all set. In my case I needed to start my virtual machine by running Docker Quickstart Terminal.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment