我正在尝试在 Google Cloudrun 上部署我的抓取工具,但是出现以下错误。
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to
start: exited abnormally.
at check_response (/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py:242)
at execute (/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py:321)
at start_session (/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py:252)
at __init__ (/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py:157)
at __init__ (/usr/local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py:76)
at scrape_refresher (/app/refresher_news_crawler.py:32)
at run_crawlers (/app/main.py:30)
at dispatch_request (/usr/local/lib/python3.8/site-packages/flask/app.py:1936)
at full_dispatch_request (/usr/local/lib/python3.8/site-packages/flask/app.py:1950)
at reraise (/usr/local/lib/python3.8/site-packages/flask/_compat.py:39)
at handle_user_exception (/usr/local/lib/python3.8/site-packages/flask/app.py:1821)
at wrapped_function (/usr/local/lib/python3.8/site-packages/flask_cors/extension.py:165)
at full_dispatch_request (/usr/local/lib/python3.8/site-packages/flask/app.py:1952)
at wsgi_app (/usr/local/lib/python3.8/site-packages/flask/app.py:2447)
我假设这将是版本不匹配,但由于我的 docker 文件正在下载最新的稳定版本85.0.4183.83,即使在将其与chromedriver-binary==85.0.4183.83.0 错误不断发生之后,我也尝试了最新版本的 chromdriver-binary,但85.0.4183.87.0结果是相同。
Docker 文件:
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.8-slim
# Install manually all the missing libraries
RUN apt-get update
RUN apt-get install -y gconf-service wget libasound2 libgbm1 libappindicator3-1 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libxss1 fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils
安装过程中没有问题,只有运行过程中出现问题。任何帮助深表感谢。
拉风的咖菲猫
相关分类