【发布时间】:2018-06-27 09:42:12
【问题描述】:
我有一个非常简单的 docker 容器,它按照 these instructions 安装“google-chrome-stable”。
在容器内,我无法启动和访问调试服务器:
# start chrome in debug mode
$ google-chrome-stable --no-sandbox --remote-debugging-port=9222
# verify that I can reach the debugging server
$ curl 127.0.0.1:9222
curl: (7) Failed to connect to localhost port 9222: Connection refused
在容器之外(OSX 10.12.6),同样的过程可以正常工作:
# start chrome in debug mode
$ chrome --no-sandbox --remote-debugging-port=9222
# verify that I can reach the debugging server
$ curl localhost:9222
curl localhost:9222
<html>
<head>
<title>Inspectable pages</title>
...
我一定缺少一些东西,因为即使环境不同,这些工作流程似乎也是相同的。
谁能说明这里发生了什么?
:: 更新更多调试信息 ::
运行带有--enable-logging --v=1 标志的命令,我得到了这些日志[没有一个看起来很明显]:
[64:64:0118/111557.689426:VERBOSE1:breakpad_linux.cc(1980)] Breakpad disabled
[72:72:0118/111557.718821:VERBOSE1:zygote_main_linux.cc(594)] ZygoteMain: initializing 2 fork delegates
[72:72:0118/111557.719320:VERBOSE1:nacl_fork_delegate_linux.cc(146)] NaClForkDelegate::Init()
[72:72:0118/111557.724777:VERBOSE1:nacl_fork_delegate_linux.cc(146)] NaClForkDelegate::Init()
[72:72:0118/111557.728735:VERBOSE1:zygote_main_linux.cc(362)] Unable to load plugin internal-not-yet-present internal-not-yet-present: cannot open shared object file: No such file or directory
[72:72:0118/111557.729441:INFO:cpu_info.cc(50)] Available number of cores: 4
[64:64:0118/111557.731729:WARNING:browser_main_loop.cc(297)] Gtk: cannot open display:
运行 netstat 也没有显示:
$ netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
【问题讨论】:
-
您是否在同一个容器中运行 google-chrome-stable 和 curl 命令?或者你是在你的主机上运行 curl 吗?
-
哦,我看到了一个错字,你暴露了 9222 端口但卷曲了 7222 端口!
-
@whites11 两个命令在同一个容器中。为错字道歉,这在端口 9222 上。更新问题...
-
那有点奇怪,是否可以从 google-chrome-stable 命令中看到一些调试数据?另外,
netstat -ntpl返回什么? -
@whites11 更新了!谢谢。
标签: google-chrome docker google-chrome-devtools remote-debugging