Report this

What is the reason for this report?

Problem setting up chrome in a droplet

Posted on May 26, 2024

Hi, i was trying to run a Flask API in a droplet using the same script and Dockerfile that worked for me in other sites but i keep getting an error while i try to install chrome. I tried a couple of fixes i’ve seen in this community but nothing worked so far, any help would be appreaciated it’s my first time in digital ocean

This is the error while i build the docker in the VM:

------
Dockerfile:9
--------------------
   8 |
   9 | >>> RUN apt-get update && apt-get install -y wget unzip && \
  10 | >>>     wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
  11 | >>>     apt-get install -y ./google-chrome-stable_current_amd64.deb && \
  12 | >>>     rm google-chrome-stable_current_amd64.deb && \
  13 | >>>     apt-get clean
  14 |
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y wget unzip &&     wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb &&     apt-get install -y ./google-chrome-stable_current_amd64.deb &&     rm google-chrome-stable_current_amd64.deb &&     apt-get clean" did not complete successfully: exit code: 100

OS: Debian 10

Dockerfile:

FROM python:3.10

WORKDIR /app

COPY . /app

RUN pip install --trusted-host pypi.install.org -r requirements.txt

RUN apt-get update && apt-get install -y wget unzip && \
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
    apt-get install -y ./google-chrome-stable_current_amd64.deb && \
    rm google-chrome-stable_current_amd64.deb && \
    apt-get clean

CMD ["python", "argy.py"]

requirements.txt :

beautifulsoup4==4.12.2
pandas
selenium==4.9.1
python-dotenv
telebot
gspread
gspread-dataframe
oauth2client
Flask
webdriver-manager==4.0.0
packaging
gunicorn

And lastly my selenium setup:

chrome_options = Options()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--window-size=1920,1080")

I don’t actually need the OS to be Debian so if anyone tried or have a fix in other OS i’m willing to try.

Thanks again!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.