Golang:托管VM应用程序的预览会返回错误

时间:2015-04-11 09:09:21

标签: go docker

我尝试使用gcloud预览应用运行命令预览Go docker(App Engine ManagedVM)应用。

但我一直收到这个错误:

Traceback (most recent call last):
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module>
    _run_file(__file__, globals())
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 985, in <module>
    main()
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 978, in main
    dev_server.start(options)
  File "/Users/jwesonga/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/jwesonga/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/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 262, in _create_module
    threadsafe_override=threadsafe_override)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1463, in __init__
    super(ManualScalingModule, self).__init__(**kwargs)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 514, in __init__
    self._module_configuration)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 237, in _create_instance_factory
    module_configuration=module_configuration)
  File "/Users/jwesonga/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/jwesonga/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py", line 740, in NewDockerClient
    client.ping()
  File "/Users/jwesonga/google-cloud-sdk/./lib/docker/docker/client.py", line 711, in ping
    return self._result(self._get(self._url('/_ping')))
  File "/Users/jwesonga/google-cloud-sdk/./lib/docker/docker/client.py", line 76, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py", line 468, in get
    return self.request('GET', url, **kwargs)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py", line 456, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/sessions.py", line 559, in send
    r = adapter.send(request, **kwargs)
  File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine/lib/requests/requests/adapters.py", line 384, in send
    raise Timeout(e, request=request)
requests.exceptions.Timeout: (<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10631c7d0>, 'Connection to 192.168.59.104 timed out. (connect timeout=60)')
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]

我已经确认docker已启动并正在使用 boot2docker status 运行正在运行这在以前工作但在机器重启后,似乎没有任何效果。有什么想法吗?

2 个答案:

答案 0 :(得分:4)

主要问题是:

File "/Users/jwesonga/google-cloud-sdk/platform/google_appengine
       /lib/requests/requests/adapters.py", line 384, in send
    raise Timeout(e, request=request)
requests.exceptions.Timeout:   
(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object 
at 0x10631c7d0>, 'Connection to 192.168.59.104 timed out. 
(connect timeout=60)')
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]

当您拥有代理时通常会出现这种情况,并在pip issue 1805

中进行了讨论

应该在pip1.6中修复,但为了以防万一,你可以尝试workaround of alexandrem

/opt/venvs/ironic/lib/python2.6/site-packages/pip/_vendor/requests
/adapters.patch.py /opt/venvs/ironic/lib/python2.6/site-packages
/pip/_vendor/requests/adapters.py
209c209
if True or not proxy in self.proxy_manager:
   ^^^^
  

基本上我只是在adapter.py第209行的条件中添加一个True来始终创建一个ProxyManager实例,从而跳过池管理器逻辑。

答案 1 :(得分:0)

gcloud命令启用ah_host进程并创建应用程序的docker镜像并将其传递给Docker守护程序,在您的情况下,您的docker守护程序似乎没有响应请求。因此,要确保执行“sudo docker -d”以检查Docker守护程序是否在您的计算机上运行。 另外,检查一下,您正确设置的证书路径和TLS_VERIFY的值是否为真。

浏览文档[1],了解如何在MacOS上安装Docker

[1] https://docs.docker.com/installation/mac/