gcloud 连接到 docker 守护进程失败

gcloud connect to docker Daemon fail

我正在尝试测试新的托管 VM 功能,然后 tutorial(使用 OS X)

boot2docker安装好了。 执行 $(boot2docker shellinit) 给出以下输出:

Writing /Users/guilhermetorres/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/guilhermetorres/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/guilhermetorres/.boot2docker/certs/boot2docker-vm/key.pem
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/guilhermetorres/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

boot2docker status 打印 running

boot2docker version打印Boot2Docker-cli version: v1.5.0

尽管当我尝试使用 gcloud --verbosity debug preview app run

运行 我的应用程序时

我收到这个错误:

ERROR    2015-03-05 00:36:39,816 containers.py:742] Failed to connect to Docker Daemon due to: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)

可以看到EV变量:

DEBUG    2015-03-05 00:36:39,800 containers.py:669] Detected docker environment variables: DOCKER_HOST=tcp://192.168.59.103:2376, DOCKER_CERT_PATH=/Users/guilhermetorres/.boot2docker/certs/boot2docker-vm, DOCKER_TLS_VERIFY=1

以及完整的堆栈跟踪:

DEBUG: Running gcloud.preview.app.run with Namespace(admin_host=None, allow_skipped_files=False, api_host=None, appidentity_email_address=None, appidentity_private_key_path=None, auth_domain='gmail.com', blobstore_path=None, clear_datastore=False, cmd_func=<bound method Command.Run of <googlecloudsdk.calliope.backend.Command object at 0x10e9e5b50>>, command_path=['gcloud', 'preview', 'app', 'run'], datastore_consistency_policy='time', datastore_path=None, default_gcs_bucket_name=None, enable_cloud_datastore=False, enable_mvm_logs=False, enable_sendmail=False, format=None, h=None, help=None, host=None, jvm_flag=None, log_http=None, log_level=None, logs_path=None, markdown=None, max_module_instances=None, modules=['./app.yaml'], php_executable_path=None, project=None, python_startup_script=None, quiet=None, require_indexes=False, show_mail_body=False, smtp_allow_tls=False, smtp_host=None, smtp_password=None, smtp_user=None, storage_path=None, trace_token=None, use_mtime_file_watcher=False, user_output_enabled=None, verbosity='debug', version=None).
WARNING: The [application] field is specified in file [/Users/guilhermetorres/meetapp-xmpp-docker/app.yaml].  This field is not used by gcloud and should be removed.
DEBUG: Found Cloud SDK root: /Users/guilhermetorres/google-cloud-sdk
DEBUG: Found App Engine SDK root: /Users/guilhermetorres/google-cloud-sdk/platform/google_appengine
DEBUG: Command sys.path: ['/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/antlr3', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/fancy_urllib', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/ipaddr', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/yaml-3.10', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/rsa', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/pyasn1', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/pyasn1_modules', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/httplib2', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/oauth2client', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/concurrent', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/cherrypy', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/distutils', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/requests', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/six', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/websocket', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/jinja2-2.6', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/webob-1.2.3', '/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.1', '/Users/guilhermetorres/google-cloud-sdk/./lib', '/Users/guilhermetorres/google-cloud-sdk/lib/googlecloudsdk/gcloud', '/Users/guilhermetorres/google-cloud-sdk/lib', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload']
DEBUG: Found Cloud SDK root: /Users/guilhermetorres/google-cloud-sdk
Module [default] found in file [/Users/guilhermetorres/meetapp-xmpp-docker/app.yaml]
INFO: Looking for the Dockerfile in /Users/guilhermetorres/meetapp-xmpp-docker
INFO: Using Dockerfile found in /Users/guilhermetorres/meetapp-xmpp-docker
DEBUG: Found Cloud SDK root: /Users/guilhermetorres/google-cloud-sdk
DEBUG: Skipping pull for runtime: custom
DEBUG: Running [dev_appserver.py] with: --allow_skipped_files=False --application=meetapp-xmpp --auth_domain=gmail.com --clear_datastore=False --datastore_consistency_policy=time --dev_appserver_log_level=debug --enable_cloud_datastore=False --enable_mvm_logs=False --enable_sendmail=False --log_level=debug --require_indexes=False --show_mail_body=False --skip_sdk_update_check=True --smtp_allow_tls=False --use_mtime_file_watcher=False /Users/guilhermetorres/meetapp-xmpp-docker/app.yaml
DEBUG    2015-03-05 00:36:39,759 application_configuration.py:159] setting forwarded ports 5280,5222,8088
INFO     2015-03-05 00:36:39,759 devappserver2.py:726] Skipping SDK update check.
DEBUG    2015-03-05 00:36:39,799 wsgi_server.py:384] Failed to bind "fe80::1%lo0:56987": ('Unable to bind fe80::1%lo0:56987', error(49, "Can't assign requested address"))
INFO     2015-03-05 00:36:39,799 api_server.py:172] Starting API server at: http://localhost:56987
DEBUG    2015-03-05 00:36:39,800 containers.py:669] Detected docker environment variables: DOCKER_HOST=tcp://192.168.59.103:2376, DOCKER_CERT_PATH=/Users/guilhermetorres/.boot2docker/certs/boot2docker-vm, DOCKER_TLS_VERIFY=1
ERROR    2015-03-05 00:36:39,816 containers.py:742] Failed to connect to Docker Daemon due to: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
INFO     2015-03-05 00:36:39,817 api_server.py:588] Applying all pending transactions and saving the datastore
INFO     2015-03-05 00:36:39,817 api_server.py:591] Saving search indexes
Traceback (most recent call last):
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module>
    _run_file(__file__, globals())
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 985, in <module>
    main()
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 978, in main
    dev_server.start(options)
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 774, in start
    self._dispatcher.start(options.api_host, apis.port, request_data)
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 182, in start
    _module, port = self._create_module(module_configuration, port)
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 262, in _create_module
    threadsafe_override=threadsafe_override)
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1463, in __init__
    super(ManualScalingModule, self).__init__(**kwargs)
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 514, in __init__
    self._module_configuration)
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 237, in _create_instance_factory
    module_configuration=module_configuration)
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_factory.py", line 78, in __init__
    timeout=self.DOCKER_D_REQUEST_TIMEOUT_SECS)
  File "/Users/guilhermetorres/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py", line 743, in NewDockerClient
    raise DockerDaemonConnectionError(DOCKER_CONNECTION_ERROR)
google.appengine.tools.docker.containers.DockerDaemonConnectionError: Couldn't connect to the docker daemon.
Please check if the environment variables DOCKER_HOST, DOCKER_CERT_PATH and DOCKER_TLS_VERIFY are set correctly. If you are using boot2docker, you can set them up by executing the commands that are shown by:
boot2docker shellinit
DEBUG: Error [1] while running DevAppSever with: [--allow_skipped_files=False --application=meetapp-xmpp --auth_domain=gmail.com --clear_datastore=False --datastore_consistency_policy=time --dev_appserver_log_level=debug --enable_cloud_datastore=False --enable_mvm_logs=False --enable_sendmail=False --log_level=debug --require_indexes=False --show_mail_body=False --skip_sdk_update_check=True --smtp_allow_tls=False --use_mtime_file_watcher=False /Users/guilhermetorres/meetapp-xmpp-docker/app.yaml]
DEBUG: (gcloud.preview.app.run) DevAppSever failed with error code [1]
Traceback (most recent call last):
  File "/Users/guilhermetorres/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 551, in Execute
    result = args.cmd_func(cli=self, args=args)
  File "/Users/guilhermetorres/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1025, in Run
    result = command_instance.Run(args)
  File "/Users/guilhermetorres/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py", line 86, in TryFunc
    return func(*args, **kwargs)
  File "/Users/guilhermetorres/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/run.py", line 317, in Run
    runner.Start(*runnables)
  File "/Users/guilhermetorres/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/appengine_adapter.py", line 413, in Start
    raise DevappserverExecutionError(return_code, argv)
ToolException: DevAppSever failed with error code [1]
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]

看完这个问题https://github.com/docker/docker-py/issues/465,卸载自制软件(brew remove python)Python一切正常。