Skip to content
This repository has been archived by the owner on Feb 27, 2018. It is now read-only.

docker ps on mac is returning Cannot connect to the Docker daemon. Is 'docker -d' running on this host? #79

Closed
phuongnd08 opened this issue Oct 17, 2014 · 5 comments

Comments

@phuongnd08
Copy link

I've just upgraded to 1.3.0, did a boot2docker upgrade and then:

$ echo $DOCKER_HOST
tcp://192.168.59.103:2375

$ boot2docker version
Boot2Docker-cli version: v1.3.0
Git commit: deafc19

$ 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 13:55:03 Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

$ boot2docker ssh
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
boot2docker: 1.3.0
             master : a083df4 - Thu Oct 16 17:05:03 UTC 2014

docker@boot2docker:~$ ps aux | grep docker
  697 root     /sbin/udhcpc -b -i eth0 -x hostname boot2docker -p /var/run/udhcpc.eth0.pid
  713 root     /sbin/udhcpc -b -i eth1 -x hostname boot2docker -p /var/run/udhcpc.eth1.pid
  765 root     /usr/local/bin/docker -d -D -g /var/lib/docker -H unix:// -H tcp://0.0.0.0:2376 --tlsverify --tlscacert=/var/lib/boot2docker/tls/ca.pem --tlscert=/var/lib/boot2docker/tls/server.pem --tlskey=/var/lib/boot2docker/tls/serverkey.pem

Look like the tcp port is changed from 2375 to 2376? But the mac version wasn't updated somehow? Though the 2376 looks like magic, cause changing $DOCKER_HOST to tcp://192.168.59.103:2376 I'll get:

$ docker ps
2014/10/17 13:57:38 Get http://192.168.59.103:2376/v1.15/containers/json: malformed HTTP response "\x15\x03\x01\x00\x02\x02"
@phuongnd08
Copy link
Author

Hmm, that's weird. Doing boot2docker shellinit prints some variables but it does not apply to current shell. I copy these variables to ~/.bashrc and docker is working properly now. Here's my variables:

    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/my/home/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

@SvenDowideit
Copy link
Contributor

@phuongnd08 you need to run $(boot2docker shellinit) for it to be applied to your current bash

@andrey-vyatkin
Copy link

exporting DOCKER_TLS_VERIFY=1 solved the problem, but boot2docker shellinit does not return anything about DOCKER_TLS_VERIFY

$ boot2docker shellinit
Writing /Users/avyatkin/.docker/boot2docker-vm/ca.pem:
Writing /Users/avyatkin/.docker/boot2docker-vm/cert.pem:
Writing /Users/avyatkin/.docker/boot2docker-vm/key.pem:
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/avyatkin/.docker/boot2docker-vm

@spockz
Copy link

spockz commented Jan 14, 2015

If you do not perform $(boot2docker shellinit) the pem files are not written at all giving a different error. So be sure the pem files exist and match.

@hyperfocus1338
Copy link

The issue was with my .bash_profile. It should be like this:

export DOCKER_HOST=tcp://192.168.99.100:2376
export DOCKER_MACHINE_NAME=default
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH=/Users/username/.docker/machine/machines/default

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants