环境为 docker for win10,出异常的地方:
fn = self.logDir + "/%d-%s-%s.log" % (self.no, level, cate)
file_object = open(fn, 'a')
file_object.write(logLine)
file_object.close()
异常为:
Traceback (most recent call last):
File "/app/src/master.py", line 160, in <module>
File "/app/src/master.py", line 155, in run
File "/app/src/utils.py", line 133, in log
IOError: [Errno 5] Input/output error: '/app/var/log/0-warning-.log'
dockerfile 为:
FROM centos:6
RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && \
yum -y install https://centos6.iuscommunity.org/ius-release.rpm && \
yum -y install htop \
iftop \
git2u \
vixie-cron \
openssh-server \
strace \
python27 \
python27-pip && \
yum clean all
RUN ( echo "root";sleep 1;echo "root" ) | passwd
RUN git config --global credential.helper store
ENV IMAGE_VER 0.3
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo 'Asia/Shanghai' > /etc/timezone
#不用 requirements.txt 而是分开安装在 docker 更快
#2.10.6
RUN pip2.7 install redis -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com
#2.18.4
RUN pip2.7 install requests -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com
#4.6.0
RUN pip2.7 install BS4 -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com
#0.1.7
RUN pip2.7 install pytesseract -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com
#3.5.0
RUN pip2.7 install ConfigParser -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com
#3.8.0
RUN pip2.7 install selenium -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com
CMD service crond start && service sshd start && /bin/bash
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.