问题
I am on Mac OSX Yosemite, I have an error occuring when I execute the step "Running Hello World" following the Node.JS "Hello World" tutorial for Google Cloud Platform
The initial error is listed below:
Nissans-MacBook-Pro:1-hello-world nissan$ gcloud preview app deploy app.yaml --set-default
You are about to deploy the following modules:
- hello-world-project-1018/default (from [/Users/nissan/source/repos/1-hello-world/app.yaml])
Deployed URL: [https://hello-world-project-1018.appspot.com]
Do you want to continue (Y/n)? y
Beginning deployment...
Verifying that Managed VMs are enabled and ready.
If this is your first deployment, this may take a while...done.
ERROR: (gcloud.preview.app.deploy) Couldn't connect to the docker daemon.
Please consider providing the `--remote` flag to perform a hosted docker build, for which a local docker environment is unnecessary.
If you would like to perform the docker build locally, please check whether the environment variables DOCKER_HOST, DOCKER_CERT_PATH and DOCKER_TLS_VERIFY are set correctly.
With boot2docker, you can set them up by running:
boot2docker shellinit
and executing the commands that boot2docker shows.
I followed the advice in the error and included the --remote flag for the command with the following error again:
Nissans-MacBook-Pro:1-hello-world nissan$ gcloud preview app deploy app.yaml --set-default --remote
You are about to deploy the following modules:
- hello-world-project-1018/default (from [/Users/nissan/source/repos/1-hello-world/app.yaml])
Deployed URL: [https://hello-world-project-1018.appspot.com]
Do you want to continue (Y/n)? y
Beginning deployment...
Verifying that Managed VMs are enabled and ready.
Provisioning remote build service.
Created [https://www.googleapis.com/compute/v1/projects/hello-world-project-1018/global/firewalls/allow-gae-builder].
NAME NETWORK SRC_RANGES RULES SRC_TAGS TARGET_TAGS
allow-gae-builder default 0.0.0.0/0 tcp:2376
Copying certificates for secure access. You may be prompted to create an SSH keypair.
Warning: Permanently added '104.197.79.93' (RSA) to the list of known hosts.
ERROR: Failed to connect to Docker Daemon due to: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
ERROR: (gcloud.preview.app.deploy) Couldn't connect to the docker daemon.
Please consider providing the `--remote` flag to perform a hosted docker build, for which a local docker environment is unnecessary.
If you would like to perform the docker build locally, please check whether the environment variables DOCKER_HOST, DOCKER_CERT_PATH and DOCKER_TLS_VERIFY are set correctly.
With boot2docker, you can set them up by running:
boot2docker shellinit
and executing the commands that boot2docker shows.
Any advice to solve would be appreciated.
Boot2Docker and Google Cloud Platform versions are listed below:
Boot2Docker-cli version: v1.7.1
Git commit: 8fdc6f5
Google Cloud SDK 0.9.70
app 2015.07.16
bq 2.0.18
bq-nix 2.0.18
core 2015.07.16
core-nix 2015.06.02
gcloud 2015.07.16
gsutil 4.13
gsutil-nix 4.12
preview 2015.07.16
回答1:
I think this problem is related to the Python that Homebrew installs and the certificates. See https://github.com/docker/compose/issues/890
My solution was to run brew remove python then go to https://www.python.org/downloads/ and download and install the Mac python from there.
Good news is there's a fix pending
回答2:
I went through a heck of a battle to get this to work. I wish I could remember every step, but I'll try to provide as much as I remember below:
Install Boot2Docker CLI, if not done already
Add an app.yaml file to your project's root directory. Here is an example of mine running a nodejs app: https://gist.github.com/anonymous/7255416f58b56d282e6b -- I took this directly from Google's sample node app (bookshelf).
In project directory, run
boot2docker up-- this will prompt you to run another command with some environment variables you have to set. Without doing this, I got the error that the author gets.
Here's that:
Waiting for VM and Docker daemon to start...
.o
Started.
Writing /Users/bryan/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/bryan/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/bryan/.boot2docker/certs/boot2docker-vm/key.pem
To connect the Docker client to the Docker daemon, please set:
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/bryan/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
Or run: `eval "$(boot2docker shellinit)"`
I ran eval "$(boot2docker shellinit)"
- Run
gcloud preview app deploy app.yaml --set-default --version X
Additional note is that for some reason, I think (not sure) that it wouldn't work without the version flag, so try that where X is replaced by a version number of your app.
I believe that these are the full steps I took that finally made it work. Hopefully it helps, at least.
回答3:
Are you sure whether the Boot2docker is up. Did you try running "boot2docker up" and setting the environment variables?
来源:https://stackoverflow.com/questions/31633228/node-js-running-hello-world-on-google-cloud-platform-error-deployment-error