docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.63k stars 1.97k forks source link

Remote error: handshake failure #1683

Open anshumanbh opened 9 years ago

anshumanbh commented 9 years ago

I installed a fresh copy of docker toolbox and had docker-machine up and running just fine.

As soon as I run the docker run command as shown below: docker run -dt -p 127.0.0.1:8483:80 /

I start seeing this error: (env)bash-3.2$ docker images An error occurred trying to connect: Get https://192.168.99.100:2376/v1.20/images/json: remote error: handshake failure (env)bash-3.2$ docker ps -a An error occurred trying to connect: Get https://192.168.99.100:2376/v1.20/containers/json?all=1: remote error: handshake failure

Does anybody know why this is happening? The versions are listed below:

(env)bash-3.2$ docker --version Docker version 1.8.0, build 0d03096

(env)bash-3.2$ docker-machine --version docker-machine version 0.4.0 (9d0dc7a)

(env)bash-3.2$ docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM default * virtualbox Running tcp://192.168.99.100:2376

Does it have to do with how the registry accepts connections? I am trying to connect to our internal docker registry so it might be configured in a different way. Is there a way to get past this?

Thanks!

anshumanbh commented 9 years ago

The docker run command got cut above..It looks something like this:

docker run -dt -p 127.0.0.1:8483:80 docker-registry.test.com/test

nathanleclaire commented 9 years ago

Well, you should be able to do docker images and docker ps without any issue, regardless of which registry you are eventually wanting to use.

Can you try:

$ docker-machine regenerate-certs -f default
$ eval $(docker-machine env default)
$ docker ps

And post the output of:

$ docker-machine ssh default cat /var/log/docker.log

Preferably in a Github Gist?

anshumanbh commented 9 years ago

So, after yesterday, I didn't do anything. Now, when I typed "docker ps -a", I got the following message: usxxbharta1m1:~ bharta1$ docker ps -a Get http:///var/run/docker.sock/v1.20/containers/json?all=1: dial unix /var/run/docker.sock: no such file or directory.

I ran the following commands: $ docker-machine regenerate-certs -f default $ eval $(docker-machine env default) $ docker ps

And, everything was working fine again.

But then, I ran my "docker run" command, and I start seeing the same error now: (env)usxxbharta1m1:ecr bharta1$ docker ps -a An error occurred trying to connect: Get https://192.168.99.100:2376/v1.20/containers/json?all=1: remote error: handshake failure

The log file as requested is here - https://gist.github.com/anshumanbh/8ad8be4ea9b84708a93f

Is it because my virtualbox VM is in NAT mode? I remember facing something similar with boot2docker every time I would connect to a VPN using the Cisco AnyConnect client. I am not using Cisco AnyConnect anymore though so I don't really know why its failing with the handshake error.

ehazlett commented 9 years ago

The Cisco VPN will definitely interfere. It could be something left over that is causing the issue. Could you try docker-machine stop default and docker-machine start default?

anshumanbh commented 9 years ago

I am not using the Cisco VPN anymore so I don't see any reason why it should interfere.

I did the docker-machine stop default and docker-machine start default. I was able to run the docker ps -a and docker images command just fine.

But, then when I run my docker run command again as shown below, I start getting a new error message now: docker run -dt -p 127.0.0.1:8483:80 docker-registry.test.com/test

Error message: "Cannot connect to the Docker daemon. Is 'docker -d' running on this host?"

Now, when I do the docker-machine stop default and docker-machine start default commands and then docker ps -a, I still get the above error.

So, again, I am not exactly sure what's going on here..

marzolfb commented 9 years ago

I had the same issues as @anshumanbh and from past experience fighting with docker behind my corporate proxy environment, I realized I just needed to set my "no_proxy" environment variable to tell docker to bypass my corp proxy when communicating with my vm:

export no_proxy=$no_proxy,192.168.99.100

Not sure if this is what's going on but thought I'd mention it...

tristanwietsma commented 9 years ago

Thanks @marzolfb , that worked for me.

nathanleclaire commented 9 years ago

Thanks @marzolfb @tristanwietsma for the feedback, working on https://github.com/docker/machine/pull/631 and some new guides to help to try and mitigate this type of issue.

marcellodesales commented 8 years ago

@nathanleclaire I'm getting this same error on Docker-machine 0.5.4... https://github.com/docker/machine/issues/2628 Is this related?