Question

run dockerfile in debian droplet, errored out google-chrome-stable_current_amd64.deb returned a non-zero code: 100

Hello I have similar issue in this question:Cannot Get Google Chrome (google-chrome-stable_current_amd64.deb) to download on VM.

I want to use dockerfile to install chrome in droplet directly. It was errored when process chrome installation command.

I tried commands in the linked answer. it doesn’t work as well. do you know have any other suggestions? Is there anything I missed? Is that version issue? How can I change to use an old version?

Besides,if I type google-chrome --version in cmd directly. I can see found google chrome

Google Chrome 120.0.6099.109
Unpacking google-chrome-stable (120.0.6099.109-1) ...
dpkg-deb: error: <decompress> subprocess was killed by signal (Killed)
dpkg: error processing archive /tmp/apt-dpkg-install-mNxaOF/087-google-chrome-stable_current_amd64.deb (--unpack):
 cannot copy extracted data for './opt/google/chrome/chrome' to '/opt/google/chrome/chrome.dpkg-new': unexpected end of file or stream
.....
Selecting previously unselected package zutty.
Preparing to unpack .../192-zutty_0.14.0.20230218+dfsg1-1_amd64.deb ...
Unpacking zutty (0.14.0.20230218+dfsg1-1) ...
Errors were encountered while processing:
 /tmp/apt-dpkg-install-mNxaOF/087-google-chrome-stable_current_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c apt-get install -y ./google-chrome-stable_current_amd64.deb' returned a non-zero code: 100

This is my dockerfile:

# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set environment variables for Python
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    unzip \
    wget \
    gnupg2 \
    ca-certificates \
    apt-transport-https \
    software-properties-common
# Add Google Chrome to the repositories
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'

# Install Google Chrome
RUN apt-get update && apt-get install -y google-chrome-stable

#OR
#wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
#sudo dpkg -i google-chrome-stable_current_amd64.deb
#sudo apt-get -f install -y

RUN google-chrome --version
RUN wget -q --continue -P /chromedriver "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/120.0.6099.71/linux64/chromedriver-linux64.zip" \
     && unzip /chromedriver/chromedriver* -d /usr/local/bin/

# Install Python dependencies
COPY requirements.txt /app/
#RUN apt-get install python3-pip
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# Copy the current directory contents into the container at /app
COPY . /app/

EXPOSE 5000

ENV FLASK_APP=app.py

#CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
CMD ["gunicorn"  , "-b", "0.0.0.0:5000", "app:app"]

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
December 19, 2023
Accepted Answer

Hi there,

The error message dpkg-deb: error: <decompress> subprocess was killed by signal (Killed) suggests that the process might be getting killed due to insufficient memory or some other system constraint.

Here are a few steps you can try to resolve this issue:

  1. Increase Droplet Resources: If your Droplet has limited resources (RAM), the dpkg process might be getting killed due to out-of-memory issues. Consider resizing your Droplet to a higher configuration with more RAM and retry the installation.

  2. Add a swap file: In order to have some extra memory buffer, consider adding a swap file as described here:

    https://www.digitalocean.com/community/tutorial-collections/how-to-add-swap-space

Let me know how it goes!

On a side note, if this still does not work, what you could try is when installing Chrome, try using --no-install-recommends to minimize the number of additional packages that are installed, which can reduce the overall memory footprint during installation.

Replace:

RUN apt-get update && apt-get install -y google-chrome-stable

With:

RUN apt-get update && apt-get install -y --no-install-recommends google-chrome-stable

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel