boot2docker / osx-installer

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

Cannot connect to the Docker daemon #80

Closed drobbins closed 9 years ago

drobbins commented 9 years ago

Perhaps related to #79 ?

I tried upgrading-in-place, and when that didn't work running uninstall.sh and installing a fresh copy, with the same results (when running the boot2docker app):

bash
unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
mkdir -p ~/.boot2docker
if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
/usr/local/bin/boot2docker init 
/usr/local/bin/boot2docker up 
$(/usr/local/bin/boot2docker shellinit)
docker version
Last login: Fri Oct 17 08:42:38 on ttys001

$ bash
$ unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
$ mkdir -p ~/.boot2docker
$ if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
$ /usr/local/bin/boot2docker init 
Generating public/private rsa key pair.
Your identification has been saved in /Users/robbinsd/.ssh/id_boot2docker.
Your public key has been saved in /Users/robbinsd/.ssh/id_boot2docker.pub.
The key fingerprint is:
<snip>
The key's randomart image is:
<snip>
/usr/local/bin/boot2docker up 
$(/usr/local/bin/boot2docker shellinit)
docker version

$ /usr/local/bin/boot2docker up 
Waiting for VM and Docker daemon to start...
........................ooooooooooooooooooooooooooooooooo
Started.
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/key.pem
Your environment variables are already set correctly.

$ $(/usr/local/bin/boot2docker shellinit)
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/key.pem

$ docker version
Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): darwin/amd64
2014/10/17 14:35:22 Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

Just to make sure it wasn't the same problem as #79:

$ echo $DOCKER_HOST
tcp://192.168.59.103:2376

$ echo $DOCKER_CERT_PATH
/Users/robbinsd/.boot2docker/certs/boot2docker-vm

$ echo $DOCKER_TLS_VERIFY
1

$ docker version
Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): darwin/amd64
2014/10/17 14:58:45 Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
fatih commented 9 years ago

I have the same exact problem. Everything seems to be ok, yet it's saying Cannot connect to the Docker daemon. This was happening right after I've updated to Yosemite.

SvenDowideit commented 9 years ago

I fear that I had a similar issue when upgrading the OS after having installed virtualbox. I think that upgrading your OS may cause the virtualbox dirvers/networking not to be activated right, so your virtual host-only network stops working.

In the end, I gave up and re-installed.

are you able to ssh docker@192.168.59.103 - password tcuser? if you can,my theory is bunck.

drobbins commented 9 years ago

I was able to connect via ssh as you mentioned:

$ ssh docker@192.168.59.103
docker@192.168.59.103's password:
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
boot2docker: 1.3.0
             master : a083df4 - Thu Oct 16 17:05:03 UTC 2014
docker@boot2docker:~$ docker version
Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): linux/amd64
Server version: 1.3.0
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): c78088f
docker@boot2docker:~$

It might be worth mentioning I've not upgraded to Yosemite yet. I'm on OS X 10.9.5.

fatih commented 9 years ago

BTW I also can completely fine SSH into the machine. There is no problem with that. But still get the error message.

andrewkdouglas commented 9 years ago

I get the same issue, have not upgraded to Yosemite yet. I can ssh in:

$ boot2docker ssh
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
boot2docker: 1.3.0
             master : a083df4 - Thu Oct 16 17:05:03 UTC 2014
docker@boot2docker:~$ docker version
Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): linux/amd64
Server version: 1.3.0
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): c78088f
docker@boot2docker:~$ 

But if I try to run docker on from the mac terminal I get:

$ docker version
Client version: 1.1.1
Client API version: 1.13
Go version (client): go1.2.1
Git commit (client): bd609d2
2014/10/20 12:16:44 Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

$ boot2docker version
Client version: v1.1.1
Git commit: 8dd1935
SvenDowideit commented 9 years ago

@drobbins very odd.

I'm out of ideas at the moment :/ @tianon ?

@fatih @adouglas you need to test ssh docker@192.168.59.103 explicitly boot2docker ssh works differently. @adouglas - you clearly need to upgrade your OSX boot2docker and docker binaries - using the OSX installer will do that.

fatih commented 9 years ago

Alright here is the output, somehow it doesn't let me login:

$ ❯ boot2docker ip

The VM's Host only interface IP address is: 192.168.59.104

$ ❯ ssh docker@192.168.59.104
The authenticity of host '192.168.59.104 (192.168.59.104)' can't be established.
RSA key fingerprint is 07:09:30:c2:ba:9f:ec:93:7b:6e:c2:f6:e1:6a:d3:b8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.59.104' (RSA) to the list of known hosts.
docker@192.168.59.104's password:
Permission denied, please try again.
docker@192.168.59.104's password:
Permission denied, please try again.
docker@192.168.59.104's password:
Permission denied (publickey,password,keyboard-interactive).
andrewkdouglas commented 9 years ago

@SvenDowideit I've updated my binarys from boot2docker.io (and updated to Yosemite) and now get the following (ran upgrade first to be sure I was up to date):

$ boot2docker upgrade
Latest release for boot2docker/boot2docker is v1.3.0
Downloading boot2docker ISO image...
Success: downloaded https://github.com/boot2docker/boot2docker/releases/download/v1.3.0/boot2docker.iso
    to /Users/andy/.boot2docker/boot2docker.iso
Waiting for VM and Docker daemon to start...
..........................................................................oooooooo
Started.
Writing /Users/andy/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/andy/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/andy/.boot2docker/certs/boot2docker-vm/key.pem
Your environment variables are already set correctly.

$ docker version
Password:
Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): darwin/amd64
2014/10/21 14:34:38 Get http://192.168.59.103:2376/v1.15/version: malformed HTTP response "\x15\x03\x01\x00\x02\x02"

$ ssh docker@192.168.59.103
The authenticity of host '192.168.59.103 (192.168.59.103)' can't be established.
RSA key fingerprint is 07:98:e7:b4:94:2b:7c:ba:b4:31:6c:89:d2:ee:82:d6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.59.103' (RSA) to the list of known hosts.
docker@192.168.59.103's password: 
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
boot2docker: 1.3.0
             master : a083df4 - Thu Oct 16 17:05:03 UTC 2014
docker@boot2docker:~$ exit
Connection to 192.168.59.103 closed.

@fatih did you use the password tcuser ?

andrewkdouglas commented 9 years ago

Fixed by $(boot2docker shellinit)

drobbins commented 9 years ago

@adouglas awesome. Didn't work for me unfortuneately:

$ boot2docker up
Waiting for VM and Docker daemon to start...
................ooo
Started.
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/key.pem
Your environment variables are already set correctly.

$ $(boot2docker shellinit)
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/robbinsd/.boot2docker/certs/boot2docker-vm/key.pem

$ docker version
Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): darwin/amd64
2014/10/21 15:59:09 Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
SvenDowideit commented 9 years ago

@tianon

drobbins commented 9 years ago

Not sure if this is related. I was trying to connect by manually specifying the -H parameter, and got a different error message:

$ echo $DOCKER_HOST

$ docker --host=tcp://192.168.59.103:2376 version
2014/10/27 20:07:17 Please specify only one -H

$ docker -H tcp://192.168.59.103:2376 version
2014/10/27 20:07:28 Please specify only one -H
SvenDowideit commented 9 years ago

That sir @drobbins is astounding. I can't get mine to do that.

perhaps we should consider the possibility that you r docker binary is corrupt?

SvenDowideit commented 9 years ago

or more realostically, that you have a shell alias that already adds a --host

drobbins commented 9 years ago

Today is the day I learn the type command:

$ which docker
/usr/local/bin/docker

$ type docker
docker is aliased to 'docker -H tcp://127.0.0.1:4243'

A little more searching found the offending alias, which I guess I set up for a previous version of boot2docker. Sorry for the noise; thanks for the help.

SvenDowideit commented 9 years ago

nice! :)