How to install Google Chrome in Docker?

Viewed 393

I'm trying to install Google Chrome in Docker in order to run Selenium. For context, I am running this on an Apple Mac M1 Chip.

Here is the part of my dockerfile to install chrome:

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

When I run docker -t build, I get this error:


 => ERROR [ 5/11] RUN apt-get install -y google-chrome-stable                                                                                                                                          0.9s
------                                                                                                                                                                                                      
 > [ 5/11] RUN apt-get install -y google-chrome-stable:                                                                                                                                                     
#8 0.412 Reading package lists...                                                                                                                                                                           
#8 0.742 Building dependency tree...
#8 0.821 Reading state information...
#8 0.870 E: Unable to locate package google-chrome-stable
------
executor failed running [/bin/sh -c apt-get install -y google-chrome-stable]: exit code: 100

How do I properly install Chrome on Docker? It would also be helpful if someone shares how to run Selenium in Docker via a Dockerfile.

0 Answers
Related