首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Docker gremlin-server:“无法分配请求的地址”

Docker gremlin-server:“无法分配请求的地址”
EN

Stack Overflow用户
提问于 2019-02-02 07:20:41
回答 1查看 302关注 0票数 1

我对Docker有点新手,所以如果这是显而易见的,请原谅我。

我有两个码头集装箱,我想和他们谈谈。一种是开箱即用地运行gremlin-server实例。我是从命令docker run --name="gremlin-server" -p 8182:8182 tinkerpop/gremlin-server开始的

另一个是使用lambci运行一个lambda函数。要运行我的基本测试函数,我使用命令docker run --rm -v "$PWD"/lambda:/var/task -v "$PWD"/layer:/opt lambci/lambda:python3.6 test_containers.lambda_handler

下面是我的test_containers.py代码:

代码语言:javascript
复制
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.process.anonymous_traversal import traversal


def lambda_handler(event, context):
    gremlin_url = 'ws://localhost:8182/gremlin'
    g = traversal().withRemote(DriverRemoteConnection(gremlin_url, 'g'))

下面是我从lambda函数返回的错误:

代码语言:javascript
复制
{
   "errorMessage":"[Errno 99] Cannot assign requested address",
   "errorType":"OSError",
   "stackTrace":[
      [
         "/var/task/test_containers.py",
         7,
         "lambda_handler",
         "g = traversal().withRemote(DriverRemoteConnection(gremlin_url, 'g'))"
      ],
      [
         "/opt/python/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py",
         45,
         "__init__",
         "password=password)"
      ],
      [
         "/opt/python/lib/python3.6/site-packages/gremlin_python/driver/client.py",
         76,
         "__init__",
         "self._fill_pool()"
      ],
      [
         "/opt/python/lib/python3.6/site-packages/gremlin_python/driver/client.py",
         92,
         "_fill_pool",
         "conn = self._get_connection()"
      ],
      [
         "/opt/python/lib/python3.6/site-packages/gremlin_python/driver/client.py",
         105,
         "_get_connection",
         "self._transport_factory, self._executor, self._pool)"
      ],
      [
         "/opt/python/lib/python3.6/site-packages/gremlin_python/driver/connection.py",
         40,
         "__init__",
         "self.connect()"
      ],
      [
         "/opt/python/lib/python3.6/site-packages/gremlin_python/driver/connection.py",
         46,
         "connect",
         "self._transport.connect(self._url)"
      ],
      [
         "/opt/python/lib/python3.6/site-packages/gremlin_python/driver/tornado/transport.py",
         33,
         "connect",
         "lambda: websocket.websocket_connect(url))"
      ],
      [
         "/opt/python/lib/python3.6/site-packages/tornado/ioloop.py",
         458,
         "run_sync",
         "return future_cell[0].result()"
      ],
      [
         "/opt/python/lib/python3.6/site-packages/tornado/concurrent.py",
         238,
         "result",
         "raise_exc_info(self._exc_info)"
      ],
      [
         "<string>",
         4,
         "raise_exc_info",
         ""
      ],
      [
         "/opt/python/lib/python3.6/site-packages/tornado/iostream.py",
         1117,
         "connect",
         "self.socket.connect(address)"
      ]
   ]
}

所以我不确定a.我是否使用了正确的url来访问服务器,b.我需要做更多的设置才能让他们说话。

我在windows上运行docker。我可以设置一个ubuntu虚拟机来运行它们,但这似乎...多余的。任何帮助都是非常感谢的。

EN

回答 1

Stack Overflow用户

发布于 2019-06-07 16:46:29

不是gremlin_url = 'ws://localhost:8182/gremlin‘,而是gremlin_url = 'ws://host.docker.internal:8182/gremlin’或您的docker容器主机名。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54488396

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档