[英]Node-inspector in docker does not load sources
I've two docker containers with different images. 我有两个具有不同图像的Docker容器。 This is the partial output of "docker ps" command:
这是“ docker ps”命令的部分输出:
$user: docker ps
CONTAINER ID IMAGE PORTS
9c8ff81215d4 node:slim 0.0.0.0:5858->5858/tcp, 0.0.0.0:10101->10101/tcp
d85a0de91432 node-debug 0.0.0.0:8080->8080/tcp
The first container is running a server app with debug option: 第一个容器正在运行带有调试选项的服务器应用程序:
$user: node --debug server.js
Debugger listening on port 5858
...
and listens on port 5858 with debugger and on port 10101 with server.js app. 并使用调试器监听端口5858和使用server.js应用监听端口10101。
The second container is running node-inspector 第二个容器正在运行节点检查器
$user: node-inspector
Node Inspector v0.12.6
Visit http://127.0.0.1:8080/?port=5858
that connects by default on port 5858 to debugger and listens on port 8080 for web-inspector in Chrome. 默认情况下在端口5858上连接到调试器,并在端口8080上侦听Chrome中的Web检查器。
The issue is when I visit http://127.0.0.1:8080/?port=5858 I see the inspector without loaded sources. 问题是当我访问http://127.0.0.1:8080/?port=5858时,我看到检查器没有加载源。
In the Chrome console is see this error: 在Chrome控制台中看到此错误:
Request with id = 10 failed. "ErrorNotConnected: Error: connect ECONNREFUSED 127.0.0.1:5858. Is node running with --debug port 5858?"
The problem here is that node inspector is trying to connect to localhost/127.0.0.1, ie local to that container , not local to your host. 这里的问题是节点检查器正在尝试连接到localhost / 127.0.0.1,即该容器本地,而不是主机本地。 When you run in bridge networking (default), each container is on its own IP.
在网桥网络中运行时(默认),每个容器都位于其自己的IP上。
You could quickly resolve this with either of these options: 您可以使用以下任一选项快速解决此问题:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.