2

I have a Dockerfile that installs Google Chrome and chromedriver

FROM python:3.9 AS base

ENV PATH "/opt/venv/bin:$PATH"
ENV PYTHONUNBUFFERED True
ENV PYTHONDONTWRITEBYTECODE True

FROM base as builder
RUN python -m venv /opt/venv
COPY requirements requirements
RUN pip install requests
RUN pip install -r requirements/common.txt

FROM base
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt-get -y update
RUN apt-get install -y google-chrome-stable

RUN apt-get install -yqq unzip
RUN wget -qO /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip
RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/

ENV DISPLAY=:1

WORKDIR /app
COPY --from=builder /opt/venv /opt/venv
COPY . .

ARG PORT=5000
ENV PORT $PORT
EXPOSE $PORT

CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 api:app

It always worked, until today I got the error:

(unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Is some new release of chromedriver or google it self that broke?

What can be?

Rodrigo
  • 135
  • 4
  • 45
  • 107

1 Answers1

0

When DISPLAY is :0, you MUST add the option headless

options.add_argument("--headless")
Rodrigo
  • 135
  • 4
  • 45
  • 107