带有python3,chromedriver,chrome&的Docker映像硒 [英] Docker image with python3, chromedriver, chrome & selenium
问题描述
我的目标是使用
我ve到处寻找并没有找到安装了以下所有程序的docker映像:
有人可以将我链接到 docker image 并安装了所有这些并且可以一起工作吗?
也许构建自己的镜像并不像我认为,但是到目前为止,这已经暗示了我。
任何人和所有建议都值得赞赏。
尝试 https://github.com/SeleniumHQ/docker-selenium 。
它已安装python:
$ docker run selenium / standalone -chrome python3 --version
Python 3.5.2
说明指示您以
docker run -d -p 4444:4444 --shm-size = 2g硒/独立铬
编辑:
允许Selenium通过python运行,看来您需要安装软件包。创建以下 Dockerfile
:
FROM硒/独立铬
用户root
运行wget https://bootstrap.pypa.io/get-pip.py
运行python3 get-pip.py
运行python3 -m pip安装硒
然后您可以使用
<$ p运行它$ p>
docker build。 -t硒铬b
docker run -it selenium-chrome python3
与普通相比的优势 python
泊坞窗映像是,您不需要安装chromedriver本身,因为它来自 selenium / standalone-chrome
。
My objective is to scrape the web with Selenium driven by Python from a docker container.
I've looked around for and not found a docker image with all of the following installed:
Is anyone able to link me to a docker image with all of these installed and working together?
Perhaps building my own isn't as difficult as I think, but it's alluded me thus far.
Any and all advice appreciated.
Try https://github.com/SeleniumHQ/docker-selenium.
It has python installed:
$ docker run selenium/standalone-chrome python3 --version
Python 3.5.2
The instructions indicate you start it with
docker run -d -p 4444:4444 --shm-size=2g selenium/standalone-chrome
Edit:
To allow selenium to run through python it appears you need to install the packages. Create this Dockerfile
:
FROM selenium/standalone-chrome
USER root
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python3 get-pip.py
RUN python3 -m pip install selenium
Then you could run it with
docker build . -t selenium-chrome && \
docker run -it selenium-chrome python3
The advantage compared to the plain python
docker image is that you won't need to install the chromedriver itself since it comes from selenium/standalone-chrome
.
这篇关于带有python3,chromedriver,chrome&的Docker映像硒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!