[Solved] Unable to install Google Chrome on Docker

I’m currently facing an issue in installing Google Chrome in my docker – this set up was working yesterday but as of today I’m getting this error –

This is how I’m installing Chrome

    ENV CHROME_VERSION "google-chrome-stable"
RUN apt-get update
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - 
  && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list 
  && apt-get -qqy install 
    ${CHROME_VERSION:-google-chrome-stable} 
  && rm /etc/apt/sources.list.d/google-chrome.list 
  && rm -rf /var/lib/apt/lists/*

This throws an error

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

If I remove the apt-get update part, then the above error doesn’t come but the google-chrome-stable is not found

ENV CHROME_VERSION "google-chrome-stable"
    RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - 
      && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list 
      && apt-get -qqy install 
        ${CHROME_VERSION:-google-chrome-stable} 
      && rm /etc/apt/sources.list.d/google-chrome.list 
      && rm -rf /var/lib/apt/lists/*

Then the error is

E: Unable to locate package google-chrome-stable

Further , I found a link which recommends removing jessiehttps://lists.debian.org/debian-devel-announce/2019/03/msg00006.html

How can I configure to remove both the errors since this was working all fine yesterday and my docker build was successful.

Solution #1:

http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages delivers a 404 indeed. I don’t know why that is but you are not the only person affected: https://github.com/docker-library/official-images/issues/3551

So as a workaround you have to comment out the line containing that URL in the sources.list before running apt-get update to make sure that it doesn’t fail. I used sed for that (sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g').

So I could install chrome successfully by modifying your Dockerfile to look like:

FROM debian:jessie
ENV CHROME_VERSION "google-chrome-stable"
RUN sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g' /etc/apt/sources.list 
  && apt-get update && apt-get install wget -y
ENV CHROME_VERSION "google-chrome-stable"
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - 
  && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list 
  && apt-get update && apt-get -qqy install ${CHROME_VERSION:-google-chrome-stable}
CMD /bin/bash
Respondent: demouser123

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.