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

Unable to connect to Docker daemon, Maximum number of retries (60) exceeded #2879

Closed alycda closed 6 years ago

alycda commented 8 years ago

Hi,

Last week I was able to run docker without any issues. The only thing that I have changed since then was upgrading node to latest stable, v5.4.1

Steps to reproduce:

$ docker-machine start default
Starting VM...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

$ eval "$(docker-machine env default)"
Maximum number of retries (60) exceeded

Because of the last error, I am unable to run docker:

$ docker run -i -p 80:80 -p 8080:8080 --add-host='<REDACTED>' --add-host='<REDACTED>' --add-host='<REDACTED>' -v `pwd`:/var/folder_name -t alyda/tr $1
Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

docker-machine version 0.4.1 (e2c88d6)

alycda commented 8 years ago

So I upgraded docker-machine to version 0.5.6, build 61388e9, but I am still getting errors:

$ docker-machine start default
Starting "default"...
(default) Waiting for an IP...
Machine "default" was started.
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

$ eval "$(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: getsockopt: connection refused
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-machine regenerate-certs default
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Detecting the provisioner...
Unable to verify the Docker daemon is listening: Maximum number of retries (10) exceeded

$ docker run -i -p 80:80 -p 8080:8080 --add-host='<REDACTED>' --add-host='<REDACTED>' --add-host='<REDACTED>' -v `pwd`:/var/folder_name -t alyda/tr $1
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
jeanlaurent commented 8 years ago

what does a docker-machine ls returns ?

You may have to delete / recreate a machine if still stuck. To do this :

docker-machine rm -f default
docker-machine create -d virtualbox default

btw, on which OS are your running all this ?

alycda commented 8 years ago
$ docker-machine ls
NAME      ACTIVE   URL          STATE     URL   SWARM   DOCKER    ERRORS
default   -        virtualbox   Stopped                 Unknown  

Running on OSX 10.10.5 (Yosemite)

Update: this might be more useful:

NAME      ACTIVE   URL          STATE     URL                         SWARM   DOCKER    ERRORS
default   -        virtualbox   Running   tcp://192.168.99.100:2376           Unknown   Unable to query docker version: Cannot connect to the docker engine endpoint
brandontamm commented 8 years ago

@alycda - I had the same issue twice after upgrading docker-machine. if you are using brew, you can try what I did - uninstall docker, docker-compose, docker-machine, restart your mac, and reinstall.

This worked after the above steps: ~ ❯ docker-machine create --virtualbox-memory "4096" --virtualbox-disk-size "20000" --virtualbox-cpu-count "2" --driver virtualbox dev

OS X 10.11 El Capitan Docker version 1.9.1, build a34a1d5 docker-machine version 0.5.6, build 61388e9 docker-compose version 1.5.2, build unknown

alycda commented 8 years ago

Thanks,

the following worked for me:

$ brew uninstall docker docker-compose docker-machine
Error: No such keg: /usr/local/Cellar/docker

restart computer...

$ brew install docker docker-machine
==> Downloading https://homebrew.bintray.com/bottles/docker-1.9.1_1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring docker-1.9.1_1.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/docker
Target /usr/local/bin/docker
already exists. You may want to remove it:
  rm '/usr/local/bin/docker'

To force the link and overwrite all conflicting files:
  brew link --overwrite docker

To list all files that would be deleted:
  brew link --overwrite --dry-run docker

Possible conflicting files are:
/usr/local/bin/docker
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/docker/1.9.1_1: 10 files, 9.6M
==> Downloading https://homebrew.bintray.com/bottles/docker-machine-0.5.6_1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring docker-machine-0.5.6_1.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/docker-machine
Target /usr/local/bin/docker-machine
already exists. You may want to remove it:
  rm '/usr/local/bin/docker-machine'

To force the link and overwrite all conflicting files:
  brew link --overwrite docker-machine

To list all files that would be deleted:
  brew link --overwrite --dry-run docker-machine

Possible conflicting files are:
/usr/local/bin/docker-machine
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/docker-machine/0.5.6_1: 5 files, 36.3M
$ docker-machine create -d virtualbox dev
Running pre-create checks...
(dev) You are using version 4.3.34r104062 of VirtualBox. If you encouter issues, you might want to upgrade to version 5 at https://www.virtualbox.org
Creating machine...
(dev) Copying /Users/adavis/.docker/machine/cache/boot2docker.iso to /Users/adavis/.docker/machine/machines/dev/boot2docker.iso...
(dev) Creating VirtualBox VM...
(dev) Creating SSH key...
(dev) Starting the VM...
(dev) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available...
Detecting operating system of created instance...
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 Docker to this machine, run: docker-machine env dev
$ eval $(docker-machine env dev)
$ docker run -i -p 80:80 -p 8080:8080 --add-host='<REDACTED>' --add-host='<REDACTED>' --add-host='<REDACTED>' -v `pwd`:/var/folder_name -t alyda/tr $1
Unable to find image 'alyda/tr:latest' locally
latest: Pulling from alyda/tr
...

The 'dev' machine appears to be working now, but the 'default' machine is still broken. I don't care to fix it if I can work off the recently created 'dev' machine but I am curious to know what happened and how to prevent it.

dev machine running:

$ docker-machine ls
NAME      ACTIVE   URL          STATE     URL                         SWARM   DOCKER    ERRORS
default   -        virtualbox   Stopped                                       Unknown   
dev       *        virtualbox   Running   tcp://192.168.99.100:2376           v1.9.1    

attempting to run 'default'

$ docker-machine ls
NAME      ACTIVE   URL          STATE     URL                         SWARM   DOCKER    ERRORS
default   *        virtualbox   Running   tcp://192.168.99.100:2376           Unknown   Unable to query docker version: Cannot connect to the docker engine endpoint
dev       -        virtualbox   Stopped                                       Unknown   
dideler commented 8 years ago

Running into the same issue as described in https://github.com/docker/machine/issues/2879#issuecomment-173027837.

Output of docker-machine ls

NAME      ACTIVE   URL          STATE     URL                         SWARM   DOCKER    ERRORS
default   *        virtualbox   Running   tcp://192.168.99.100:2376           Unknown   Unable to query docker version: Cannot connect to the docker engine endpoint

Docker version 1.9.1, build a34a1d5 docker-machine version 0.5.6, build 61388e9 docker-compose version 1.5.2, build 7240ff3

Installed with DockerToolbox-1.9.1i.pkg

Recreating the default machine worked, did not have to reinstall docker or restart computer.

jimzucker commented 8 years ago

I am suddenly having the same issue:

➜ ~ docker-machine start default Starting "default"... (default) Waiting for an IP... Too many retries waiting for SSH to be available. Last error: Maximum number of retries (60) exceeded

Deleting the machine and trying to re-create it seemed to work, but it look some time:

➜ ~ docker-machine create -d virtualbox default Running pre-create checks... Creating machine... (default) Copying /Users/jaz/.docker/machine/cache/boot2docker.iso to /Users/jaz/.docker/machine/machines/default/boot2docker.iso... (default) Creating VirtualBox VM... (default) Creating SSH key... (default) Starting the VM... (default) Waiting for an IP... Waiting for machine to be running, this may take a few minutes... Machine is running, waiting for SSH to be available... Detecting operating system of created instance... 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 Docker to this machine, run: docker-machine env default

jpae commented 8 years ago

I ran into the same issue of Unable to query docker version: Cannot connect to the docker engine endpoint This happened after using a VPN. Fortunately, I didn't have to create a new one. What I did to bring it back to life is just stop it and start it again.

rehia commented 8 years ago

Same for me here. Like @alycda, my VM was running. And like @jpae, I just restarted it, and I didn't get error messages anymore.

rafaelverger commented 8 years ago

@jimzucker @dideler @alycda I got the same issue here. It seems to started after I've updated docker and docker-machine. I tried to stop/start but it doesn't worked and when I remove them and try to create again I got this message:

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.10.2
(default) Downloading /Users/rafaelverger/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v1.10.2/boot2docker.iso...
spencerkohan commented 8 years ago

Having the same problem.

I'm running OSX 10.11 - my setup was working fine, and after a couple weeks of not working with Docker this is now happening:

NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
default   -        virtualbox   Running   tcp://192.168.99.100:2376           Unknown   Unable to query docker version: Cannot connect to the docker engine endpoint

I have now updated the docker toolkit, and virtual box, but the error was showing up before I changed anything. I may have run some updates to OSX in that time, but I am not sure.

versions:

$ docker version
Client:
 Version:      1.10.2
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   c3959b1
 Built:        Mon Feb 22 22:37:33 2016
 OS/Arch:      darwin/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

$ docker-machine version
docker-machine version 0.6.0, build e27fb87
n3integration commented 8 years ago

FWIW - I was having the same problem with the vmwarefusion driver. I eventually upgraded my docker client from 1.10.2 to 1.10.3 and recreated the boot2docker VM to resolve an issue similar to the one above. One thing that helped troubleshoot the issue was to run docker-machine with the --debug flag.

Laxman-SM commented 8 years ago

Hi, On digitalocean i'm getting error "Error creating machine: Error running provisioning: Unable to verify the Docker daemon is listening: Maximum number of retries (10) exceeded" i try to

Mac-Laxman:~ laxmansingh$ docker-machine create -d digitalocean yash Running pre-create checks... Creating machine... (yash) Creating SSH key... (yash) Creating Digital Ocean droplet... (yash) Waiting for IP address to be assigned to the Droplet... Waiting for machine to be running, this may take a few minutes... Machine is running, waiting for SSH to be available... Detecting operating system of created instance... Detecting the provisioner... Provisioning with ubuntu(systemd)... Installing Docker... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... Error creating machine: Error running provisioning: Unable to verify the Docker daemon is listening: Maximum number of retries (10) exceeded

docker-machine --version docker-machine version 0.5.3, build 4d39a66

i tried same on last week but no luck, as per my analysis systemd failing and unable to restart. anyone got success to fix the issue.

mabounassif commented 7 years ago

I was able to solve the issue by going on the VirtualBox console and remove any reference to a "default" box. I removed the whole folder ~/.docker [Do this with care as you'd loose all the machines you created, you probably can selectively remove the machines that you don't want]. Restart computer [was too lazy to pick and choose my processes]. It worked!

nhooey commented 6 years ago

@alycda: Could you reopen this issue until we find the cause and solution? It's the top-ranking Google hit for "Unable to verify the Docker daemon is listening", and it seems to continuously happen for several people.

This happens to me often when I stop the machine with docker-machine stop default and start it up again with docker-machine start default without any other changes to the system. I often have to delete and recreate the machine.

I'm using Docker on Mac OS 10.13.3 with Parallels Desktop Pro. The same issue occurs with VMWare Fusion and with VirtualBox, as reported in this bug thread. So it seems to be non-driver-specific.

$ docker-machine ls
NAME      ACTIVE   DRIVER      STATE     URL                       SWARM   DOCKER    ERRORS
default   -        parallels   Running   tcp://10.211.55.11:2376           Unknown   Unable to query docker version: Cannot connect to the docker engine endpoint

$ docker --version && docker-compose --version && docker-machine --version
Docker version 18.02.0-ce, build fc4de44
docker-compose version 1.19.0, build unknown
docker-machine version 0.14.0, build 89b8332
nhooey commented 6 years ago

@jpae: How sure are you that the VPN is affecting your broken Docker machine?

nhooey commented 6 years ago

@jimzucker @dideler @alycda I got the same issue here. It seems to started after I've updated docker and docker-machine.

It happens to me without updating anything Docker or from the OS.

brandontamm commented 6 years ago

This is no longer any issue. Previous releases many months ago have resolved issue

nhooey commented 6 years ago

This is no longer any issue. Previous releases many months ago have resolved issue

Which specific cause of the issue are you referring to?

Is it resolved as of the latest Docker versions that I mentioned in my comment?

paulsimongb commented 6 years ago

I am still getting this issue on Docker version 18.03.1-ce. I am trying to run Docket for Planning Analytics Workspace from IBM. The docket machine repeatedly fails at this step Setting Docker configuration on the remote daemon.... No explanation is given.

duxbuse commented 5 years ago

Im still having this same issue

paulsimongb commented 5 years ago

Strange this issue shows as closed but there are still messages. Anyway, I don't know the context you are are working in. If it is Planning Analytics, I would advise your to uninstall everything. Put at least 16GB of RAM into the box, and then try again. It will probably work. Docker for Planning Analytics needs a lot of RAM!

nielsole commented 5 years ago

We also started having this issue at 22nd of Janauary. Maybe related to @duxbuse ? Or did you have this issue before?