Scrapy-Splash:无法运行带有scrapinghub / splash:latest作为基础映像的docker容器

时间:2018-11-08 08:33:20

标签: python docker scrapy azureservicebus scrapy-splash

正在构建一个使用某些Azure服务和Scrapy-Splash的python Scrapy应用程序。我尝试使用scrapinghub/splash:latest作为本地Windows计算机中的基础映像为应用程序创建docker映像。
以下是我正在使用的Dockerfile,

FROM scrapinghub/splash:latest
WORKDIR /usr/src/snapshot

ADD requirements.txt ./
RUN pip install -r requirements.txt

ADD . ./

EXPOSE 8888 80

ENTRYPOINT ["/usr/src/snapshot/init_container.sh"]  

init_container.sh 文件包含用于运行应用程序python /usr/src/snapshot/SiteCrawler.py的语句。
现在,当我使用命令docker run testsnapshot:0.1运行docker映像时,由于导入错误 ImportError:没有名为azure.servicebus

的模块,应用程序启动和停止。

我尝试使用python:3.6.6作为基础映像创建应用程序的docker映像,它工作正常。

应用程序将构建docker映像,并正确地安装来自requirements.txt的软件包。 在我的requirements.txt内容下方附加

asn1crypto==0.24.0
attrs==18.2.0
Automat==0.7.0
azure-common==1.1.16
azure-nspkg==3.0.2
azure-servicebus==0.21.1
azure-storage==0.36.0
certifi==2018.10.15
cffi==1.11.5
chardet==3.0.4
constantly==15.1.0
cryptography==2.3.1
cssselect==1.0.3
hyperlink==18.0.0
idna==2.7
incremental==17.5.0
lxml==4.2.5
parsel==1.5.0
pip==18.0
pyasn1==0.4.4
pyasn1-modules==0.2.2
pycparser==2.19
PyDispatcher==2.0.5
PyHamcrest==1.9.0
pyOpenSSL==18.0.0
python-dateutil==2.7.3
queuelib==1.5.0
requests==2.20.0
Scrapy==1.5.1
scrapy-splash==0.7.2
service-identity==17.0.0
setuptools==39.0.1
six==1.11.0
Twisted==16.1.1
urllib3==1.24
w3lib==1.19.0
zope.interface==4.5.0

1 个答案:

答案 0 :(得分:0)

知道了。只需将 WORKDIR / usr / src / snapshot 添加到 VOLUME ,如下所示。

VOLUME ["/usr/src/snapshot"]