【发布时间】:2018-03-07 12:20:24
【问题描述】:
今天我正在一个高山容器中使用dryscrape 编写python 脚本。
这是我的 Dockerfile:
FROM alpine:3.7
RUN apk add --update bash &&\
apk update &&\
apk upgrade
RUN apk add --no-cache python-dev ;\
apk add --no-cache python
RUN apk add --no-cache py-pip &&\
apk add --no-cache linux-headers &&\
apk add --no-cache texinfo &&\
apk add --no-cache gcc &&\
apk add --no-cache g++ &&\
apk add --no-cache gfortran &&\
apk add --no-cache libxml2-dev &&\
apk add --no-cache xmlsec-dev &&\
apk add --no-cache py-requests &&\
apk add --no-cache make &&\
apk add --no-cache qt-dev
RUN pip install beautifulsoup4 &&\
pip install requests &&\
pip install lxml &&\
pip install html5lib &&\
pip install urllib3 &&\
pip install dryscrape
RUN apk add --no-cache icu-libs &&\
apk add --no-cache git &&\
git clone "https://github.com/niklasb/webkit-server.git" &&\
cd webkit-server &&\
python setup.py install
# prepare le shell
CMD ["bash"]
WORKDIR "/root"
我忘记了事情,因为我在启动 dryscrape.Session() 时收到此错误
File "/usr/lib/python2.7/site-packages/webkit_server.py", line 427, in __init__
raise WebkitServerError("webkit-server failed to start. Output:\n" + err)
webkit_server.WebkitServerError: webkit-server failed to start. Output:
webkit_server: cannot connect to X server
你知道我为什么会收到这个错误吗?谢谢大家
【问题讨论】:
标签: python-2.7 docker dockerfile alpine