Skip to content

Instantly share code, notes, and snippets.

@navarroaxel
Last active January 3, 2024 18:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save navarroaxel/3f44927c9a3e28c25a2b30c244813e07 to your computer and use it in GitHub Desktop.
Save navarroaxel/3f44927c9a3e28c25a2b30c244813e07 to your computer and use it in GitHub Desktop.
FROM node:slim
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
@Ashwin746544
Copy link

Ashwin746544 commented Aug 24, 2022

Hii,I am done same like above but still getting #6 86.29 E: Unable to locate package google-chrome-stable this error (I am using mac ),please help🙏
below is some last failed lines of above commands
`#5 22.89 Reading state information...
#5 22.96 E: Unable to locate package google-chrome-stable

executor failed running [/bin/sh -c apt-get update && apt-get install curl gnupg -y && curl --location --silent https://dl-ssl.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.list' && apt-get update && apt-get install google-chrome-stable -y --no-install-recommends && rm -rf /var/lib/apt/lists/*]: exit code: 100`

@navarroaxel
Copy link
Author

@Ashwin746544 Hi! I've build this Dockerfile and I got google-chrome-stable (104.0.5112.101-1) installed. Your error says the google.list wasn't checked to find the google-chrome-stable package.

Are you using FROM node:slim? or another base image.

Could you run docker run -it node:slim bash and run every installation command one by one

# apt-get update
# apt-get install curl gnupg -y
# curl --location --silent https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
...

Then you can "debug" the apt repositories checking if apt update finds some error with the google.list. Also you can run:

# apt list --all-versions chromium
# apt list --all-versions google-chrome-stable

to check which versions you have available

@navarroaxel
Copy link
Author

I've updated the Dockerfile to remove the following warning:

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

@thibaultchazal
Copy link

thibaultchazal commented Aug 26, 2022

Hi @navarroaxel
I have the exact same error as @Ashwin746544 and I'm also on Mac, with M2 chip to be exact

I have run docker run -it node:slim bash and then the commands one by one (the new ones from the 24th) and I have the error about not able to locate google-chrome-stable package

apt-get install google-chrome-stable -y --no-install-recommends
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package google-chrome-stable

I have tried to debug with apt list and it find one for goog-chrome-stable but it seams it is for amd64 (and my computer is using arm64)

root@08128285a5c0:/# apt list --all-versions chromium
Listing... Done
chromium/stable-security 104.0.5112.101-1~deb11u1 arm64
chromium/stable 103.0.5060.53-1~deb11u1 arm64

root@08128285a5c0:/# apt list --all-versions google-chrome-stable
Listing... Done
google-chrome-stable/stable 104.0.5112.101-1 amd64

Any clue what to do ?

BTW, I have tried on another machine (not on mac M2) and it works very well ;)

@navarroaxel
Copy link
Author

@thibaultchazal oh! Google Chrome is only packaged for amd64, but Chromium and Firefox supports arm64. You should go for that browsers.

@peti2001
Copy link

peti2001 commented Sep 7, 2022

Hi @thibaultchazal,

Try to specify the architecture when building the image. Like this:
$ docker build --platform linux/amd64 . -t your_image_name

I had the same problem on M1 Max and this solved my issue.

@BrandonCopley
Copy link

This solved it for me. --platform linux/amd64

@kamalkech
Copy link

ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get install gnupg wget -y && wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && apt-get update && apt-get install google-chrome-stable -y --no-install-recommends && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment