Docker Community Forums

Share and learn in the Docker community.

"Cannot connect to daemon" when creating new docker-machine on Google Cloud

Pretty straightforward. I’m running the following command on my Ubuntu 16.04 box:

docker-machine create --driver google
–google-project XXX
–google-zone us-central1-a
–google-machine-type n1-standard-2
dotify-4

Many things work, except the connect to Docker:


Copying certs to the remote machine…
Setting Docker configuration on the remote daemon…
Checking connection to Docker…
Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host “104.198.223.69:2376”: dial tcp 104.198.223.69: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.

When I ssh onto the box via the Google Cloud console and run sudo docker version, I get the following:

Client:
Version: 1.12.6
API version: 1.24
Go version: go1.6.4
Git commit: 78d1802
Built: Tue Jan 10 20:32:39 2017
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

I’ve reproduced this many times. What am I doing wrong?

I used the Ubuntu 16.04 google machine image (–google-machine-image “https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20170202”) and it now works.

Is it Docker Machine 0.9.0? If it’s a recent version the Google Cloud images might need to be updated. Would make a good PR…