python - Scrapy Splash 服务器无法通过 docker run 启动

标签 python docker scrapy

按照 alexce 的指示 here 安装了 docker、scrapyjs 和splash。

然后,运行 docker run -p 8050:8050 scrapinghub/splash ,我得到以下输出:

2016-05-08 17:17:45+0000 [-] Log opened.
2016-05-08 17:17:45.978866 [-] Splash version: 2.1
2016-05-08 17:17:45.979553 [-] Qt 5.5.1, PyQt 5.5.1, WebKit 538.1, sip 4.17, Twisted 16.1.1, Lua 5.2
2016-05-08 17:17:45.980138 [-] Python 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4]
2016-05-08 17:17:45.980401 [-] Open files limit: 1048576
2016-05-08 17:17:45.981020 [-] Can't bump open files limit
2016-05-08 17:17:46.086232 [-] Xvfb is started: ['Xvfb', ':1', '-screen', '0', '1024x768x24']
2016-05-08 17:17:46.161902 [-] proxy profiles support is enabled, proxy profiles path: /etc/splash/proxy-profiles
2016-05-08 17:17:46.260357 [-] verbosity=1
2016-05-08 17:17:46.260607 [-] slots=50
2016-05-08 17:17:46.261170 [-] argument_cache_max_entries=500
2016-05-08 17:17:46.262476 [-] Web UI: enabled, Lua: enabled (sandbox: enabled)
2016-05-08 17:17:46.264565 [-] Site starting on 8050
2016-05-08 17:17:46.265203 [-] Starting factory <twisted.web.server.Site object at 0x7f270ec81e10>

它卡在那里。我尝试根据 here 的说明进行故障排除(重新安装 docker、验证虚拟机是否正在运行、重新生成证书、设置环境),但仍然没有任何结果。

My settings fileSpider

当在meta= start_requests`中没有yield scrapy.Request' call within参数的情况下运行蜘蛛时,蜘蛛运行良好(除了未捕获动态字段),所以我不确定这是否是docker或splash的问题。

提前致谢。

最佳答案

当使用 Docker 运行 Splash 时,控制台一开始确实会“卡在那里”。 Splash 正在等待通过其端点之一的请求。

$ sudo docker run -p 8050:8050 scrapinghub/splash
2016-05-09 10:21:42+0000 [-] Log opened.
2016-05-09 10:21:42.773541 [-] Splash version: 2.1
2016-05-09 10:21:42.774298 [-] Qt 5.5.1, PyQt 5.5.1, WebKit 538.1, sip 4.17, Twisted 16.1.1, Lua 5.2
2016-05-09 10:21:42.774453 [-] Python 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4]
2016-05-09 10:21:42.774632 [-] Open files limit: 1048576
2016-05-09 10:21:42.774842 [-] Can't bump open files limit
2016-05-09 10:21:42.879868 [-] Xvfb is started: ['Xvfb', ':1', '-screen', '0', '1024x768x24']
2016-05-09 10:21:43.072351 [-] proxy profiles support is enabled, proxy profiles path: /etc/splash/proxy-profiles
2016-05-09 10:21:43.214478 [-] verbosity=1
2016-05-09 10:21:43.214617 [-] slots=50
2016-05-09 10:21:43.214703 [-] argument_cache_max_entries=500
2016-05-09 10:21:43.215195 [-] Web UI: enabled, Lua: enabled (sandbox: enabled)
2016-05-09 10:21:43.217494 [-] Site starting on 8050
2016-05-09 10:21:43.217635 [-] Starting factory <twisted.web.server.Site object at 0x7f529d0fee48>

要测试 Splash 是否正常运行,请尝试其 Web UI:http://localhost:8050/

您应该看到类似以下内容:

enter image description here

然后您可以尝试输入一些 URL 并单击“渲染我!”

关于python - Scrapy Splash 服务器无法通过 docker run 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37102952/

相关文章:

python - SMTP getpass.getpass() 不接受输入,你能解决这个问题吗?

python - Type-ast(setup.py)的构建轮:状态为 'error'

jquery - 有什么方法可以使用jinja2和flask形式而不是ajax和jquery或两者都使用?

python - 爬行时清空输出文件

html - 使用 scrapy 跟踪 HTML 中的标签

java - 使用套接字时,json 文件未完整到达

c# - 如何从非控制台ASP.Net应用程序捕获stdout

node.js - docker : React App doesn't read environment variable

python - PySide2 找不到 Qt_5.15

html - 表数据的正确 xpath Scrapy