12

I'm trying to preview a Go docker (App Engine ManagedVM) app using the gcloud preview app run command.

But I keep getting this error:

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]

I've confirmed that docker is up and running using boot2docker status which returns running This was working before but after a machine reboot, nothing seems to work. Any ideas?

jwesonga
  • 4,249
  • 16
  • 56
  • 83

2 Answers2

4

The main issue is:

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]

Which is often the case when you have a proxy, and is discussed in pip issue 1805

It is supposed to be fixed in pip1.6, but just in case, you can try the 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:
   ^^^^

basically I just add a True to the condition on line 209 of the adapter.py to always create a ProxyManager instance, thus skipping the pool manager logic.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @jwesonga can you check the version of pip used in your docker container? – VonC Apr 11 '15 at 10:58
  • How do I check that within the docker container? Just as an aside I'm on OSX – jwesonga Apr 11 '15 at 11:18
  • @jwesonga http://stackoverflow.com/a/27708039/6309: `docker exec pip -V` – VonC Apr 11 '15 at 11:29
  • @VoncC since the container isn't actually running (related to the error above) I can't get the container ID, or may be I'm doing it wrong. I tried: "docker ps" and got: FATA[0032] An error occurred trying to connect: Get https://192.168.59.104:2376/v1.17/containers/json: dial tcp 192.168.59.104:2376: i/o timeout – jwesonga Apr 11 '15 at 12:02
  • @jwesonga are you behind a proxy? – VonC Apr 11 '15 at 14:00
0

The gcloud command enable the ah_host process and also created the docker image of your app and passes it to the Docker daemon, in your case it seems that your docker daemon is not responding to the request. So to make sure,perform "sudo docker -d" to check if the Docker daemon is running on your machine or not. Also check that, the path of the certificate you set correctly and value of the TLS_VERIFY is TRUE.

Go through the documentation [1] for the installation of Docker on MacOS

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

Shobhit
  • 488
  • 2
  • 11
  • I ran "sudo docker -d" and got "This is a client-only binary - running the Docker daemon is not supported" – jwesonga Apr 16 '15 at 05:13
  • Found out what the "problem" is, for some weird reason I have to run "eval "$(boot2docker shellinit)" in the terminal before running "gcloud preview app run " If I open a new terminal I have to repeat the process again. I didn't think this was the case since I added the environment variables to my ~/.bash_profile, is this the intended behavior? – jwesonga Apr 16 '15 at 05:50
  • @jwesonga: you can also try echo export DOCKER_HOST=tcp://ip:port >> ~/.bashrc && source ~/.bashrc, and then run source .bash_profile and see if it works. – Shobhit Apr 16 '15 at 13:17