[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

OSX: Cannot connect to the Docker daemon. #606

Open
aaronfay opened this issue Oct 29, 2014 · 20 comments
Open

OSX: Cannot connect to the Docker daemon. #606

aaronfay opened this issue Oct 29, 2014 · 20 comments
Labels

Comments

@aaronfay
Copy link

Hello,

I've followed the download instructions for boot2docker 1.3.0, installed using the package, and followed the command line instructions:

af:~ aaronfay$ boot2docker -v
Boot2Docker-cli version: v1.3.0
Git commit: deafc19
Usage: boot2docker [<options>] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|socket|shellinit|delete|download|upgrade|version} [<args>]
af:~ aaronfay$ boot2docker init
af:~ aaronfay$ boot2docker start
Waiting for VM and Docker daemon to start...
.o
Started.
Writing /Users/aaronfay/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/aaronfay/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/aaronfay/.boot2docker/certs/boot2docker-vm/key.pem
Your environment variables are already set correctly.

af:~ aaronfay$ $(boot2docker shellinit)
Writing /Users/aaronfay/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/aaronfay/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/aaronfay/.boot2docker/certs/boot2docker-vm/key.pem
af:~ aaronfay$ docker ps
2014/10/29 16:24:37 Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

When I run boot2docker from Applications (where it opens it's own terminal) it seems to work fine, but I cannot connect to the docker daemon from my custom terminal.

@SvenDowideit
Copy link
Contributor

what does docker version - can you run it both on your OSX box, and insider the vm (run boot2docker ssh docker version )

@aaronfay
Copy link
Author

Hey @SvenDowideit, here's the output:

af:~ aaronfay$ boot2docker -v
Boot2Docker-cli version: v1.3.0
Git commit: deafc19
Usage: boot2docker [<options>] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|socket|shellinit|delete|download|upgrade|version} [<args>]
af:~ aaronfay$ boot2docker ssh
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
boot2docker: 1.3.0
             master : a083df4 - Thu Oct 16 17:05:03 UTC 2014
docker@boot2docker:~$ docker --version
Docker version 1.3.0, build c78088f

Thanks

@mcollina
Copy link

Same here. It was working smoothly on v1.2.0

@mcollina
Copy link

Let me add some more details: I was able to replicate this on three different Macs, coming from a fresh install. Any idea how I can help solve this?

nmap reports the port being open, however connecting in there gives nothing back.

@SvenDowideit
Copy link
Contributor

@aaronfay what does docker --version on the mac tell you?

mm, and what does env | grep DOCKER tell you (on the mac?)

@mcollina
Copy link

For me the problem were two:

  1. the wrong DOCKER_HOST variable, the port was changed and there was no notice (it should be written IN CAPS), also a lot of guides are now broken :(.
  2. at some point I got docker 1.2.0 reinstalled, and that was bad.

@aaronfay
Copy link
Author

Hey @SvenDowideit, here's the output from those commands. I've added a ping in just to confirm the host is available:

af:~ aaronfay$ docker --version
Docker version 1.3.0, build c78088f
af:~ aaronfay$ env | grep DOCKER
DOCKER_HOST=tcp://192.168.59.103:2376
DOCKER_TLS_VERIFY=1
DOCKER_CERT_PATH=/Users/aaronfay/.boot2docker/certs/boot2docker-vm
af:~ aaronfay$ ping 192.168.59.103
PING 192.168.59.103 (192.168.59.103): 56 data bytes
64 bytes from 192.168.59.103: icmp_seq=0 ttl=64 time=4.553 ms
64 bytes from 192.168.59.103: icmp_seq=1 ttl=64 time=3.923 ms
^C
--- 192.168.59.103 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 3.923/4.238/4.553/0.315 ms
af:~ aaronfay$ 

@7kaji
Copy link
7kaji commented Nov 2, 2014

I have the same trouble as you have.

$ boot2docker ssh docker version
Client version: 1.3.1
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 4e9bbfa
OS/Arch (client): linux/amd64
Server version: 1.3.1
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 4e9bbfa

@a-b
Copy link
a-b commented Nov 5, 2014

The same thing here. Initially I thought this issue might be related to the Kitematic

boot2docker ssh docker version
Client version: 1.3.1
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 4e9bbfa
OS/Arch (client): linux/amd64
Server version: 1.3.1
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 4e9bbfa

@datajerk
Copy link
datajerk commented Nov 6, 2014

Same here with 1.3.1. However I cannot ping the 103 interface either. "boot2docker ssh docker ps" works however.

Hack: alias docker='boot2docker ssh docker'

@Kris-Law
Copy link
Kris-Law commented Nov 7, 2014

That alias hack above does actually work, however it does not work with Chef's knife container gem. I'd love to see if anybody has found a way to get this working without hacks, so that it works globally.

@aaronfay
Copy link
Author
aaronfay commented Nov 8, 2014

Ok, so an update on this issue. I use iTerm2, which is where I'm having the problem specifically. When I run the boot2docker application from Applications I get a plain old terminal that runs a bunch of commands when it opens, and from there the docker client works fine.

Copying everything that's run verbatim from the boot2docker terminal into my custom terminal appears to solve the issue (I've left out the bash command on line 1 to spare the extra shell):

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

With that I get a functional docker client:

af:~ aaronfay$ docker version
Client version: 1.3.1
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 4e9bbfa
OS/Arch (client): linux/amd64
Server version: 1.3.1
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 4e9bbfa
af:~ aaronfay$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
af:~ aaronfay$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
dockerdemo_web      latest              3b814f6a6155        21 minutes ago      199.3 MB
ubuntu              14.04               5506de2b643b        2 weeks ago         199.3 MB
ubuntu              latest              5506de2b643b        2 weeks ago         199.3 MB
af:~ aaronfay$ 

Hope that helps anyone else.

EDIT I've also cleared out some environment variables and an alias to the docker command that I had set in my .bash_profile trying to debug the issue in the first place, and now I'm not 100% sure what the fix was. I now cannot seem to reproduce the original issue.

@Kris-Law
Copy link

None of the above things worked for me, however, I did find that when I go to Virtualbox Preferences => Network => Host Only Networks, then delete both vboxnet0 and vboxnet1, then re-add them, everything worked. Note, I ran boot2docker delete before removing the networks and adding them back. Then boot2docker init, boot2docker up and all was well.

@SamMorrowDrums
Copy link

Thanks @Kris-Law, the above suggestion worked for me too. New remote member to my team, who needed to install our dev env, and the latest B2D doesn't seem to work, without the steps above :-/

Anyway, the boot2docker delete, remove Network Only Hosts, and then B2D init and B2D up worked!

+1 for that, without that post I'd have had a nightmare doing this remotely.

@SvenDowideit
Copy link
Contributor

@tianon perhaps we should delete any host only networks that are attached to our vm when we do a boot2docker delete

@SamMorrowDrums
Copy link

Some of the issues with a colleague using the latest Boot2docker were actually with using Fig, and the update to TLS with Boot2docker was initially problematic. I think the dust has begun to settle, but there should be some way of pinning the stack to a specific version?

Node, Meteor and a number of other projects have simple ways of selecting versions for production projects and hard-coding that into the app.

Is there any way we could look at a command line flag, that can replace the version, so we can avoid issues of a stack not working on a new install?

Not all developers in the team, are dealing with Docker directly, and troubleshooting isn't always the easiest.

@fzakaria
Copy link

@Kris-Law fix also worked for me!

@petrosp
Copy link
petrosp commented Dec 18, 2014

@SamMorrowDrums Your fix does not re-add the Host Only Networks back and this is what worked for me; they are automatically recreated by VirtualBox!

@tegansnyder
Copy link

@gcochard
Copy link

boot2docker delete, then deleting all host-only networks, then boot2docker init fixed this problem for me. No need to re-create any host-only networks. Here's the version I'm running:

gcochard $ boot2docker ssh docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64
gcochard $ docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): darwin/amd64

FWIW boot2docker was working just fine for me, then I tried to build some images with docker-compose and this issue manifested itself. Have not been able to reproduce it however.

@wglambert wglambert added the Issue label Jul 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests