小弟敲了一个小爬虫,网上搜到有 scrapyd 方式部署,于是本地 pip install scrapyd。在本地测试完全爬虫跑得妥妥的,于是想仍到 docker 容器里面去。写了一个 DockerFile,内容大致如下:
FROM python:3.5.5
ENV PATH /usr/local/bin:$PATH
ADD . /scrapy_weather
WORKDIR /scrapy_weather
COPY ./scrapyd.conf /etc/scrapyd/
EXPOSE 6800
CMD scrapyd
构建了一个 docker 镜像,然后在自己的 mac 本的 docker 里面跑得飕飕的,没有一点问题,于是把镜像推送出去,结果在 centos 的服务器上面,同样的镜像,会报以下错误:
Another twistd server is running, PID 5
This could either be a previously started instance of your application or a
different application entirely. To start a new one, either run it in some other
directory, or use the --pidfile and --logfile parameters to avoid clashes.
小弟实在是没招了,想与各位 py 大佬们交流一波,scrapy 的优雅部署方式