I have written a Dockerfile based on python:3.9-slim-buster. I want to install chrome and chromedriver on top of this, but google-chrome package is not installing for some reason.
The Dockerfile:
FROM python:3.9-slim-buster
# set environment variables
ENV PIP_DISABLE_PIP_VERSION_CHECK 1
# don't write .pyc files
ENV PYTHONDONTWRITEBYTECODE 1
# prevent Docker from buffering stdout
ENV PYTHONUNBUFFERED 1
# set working directory
WORKDIR /code
COPY ./requirements.txt .
# add key and repository
# RUN sudo apt install software-properties-common apt-transport-https wget ca-certificates gnupg2 -y
# install dependencies
RUN apt-get update && apt-get install -y \
gnupg2 \
unzip \
wget
# chrome repo
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.list
RUN apt-get update && apt-get install -y \
gcc \
google-chrome-stable \
less \
libmagickwand-dev \
libpq-dev \
python3-selenium \
vim \
# && wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip \
# && unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/ \
&& rm -rf /var/lib/apt/lists/* \
&& pip install -r requirements.txt
# copy project
COPY . .
Command output for trying to find google-chrome:
root@f9832abc0069:/code# apt list --installed | grep google
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
root@f9832abc0069:/code# google-chrome
bash: google-chrome: command not found
How can I install google-chrome on my docker image?