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

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 “”: dial tcp 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:

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 “”) 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…