Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install chrome & chromedriver for Docker image 2022
Change log:
1. replaced "" with "" according
2. replaced "apt-key" as "Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8))."
3. use https
Oneliner for Dockerfile:
RUN set -ex; \
apt-get update; \
apt-get install -y gnupg wget curl unzip --no-install-recommends; \
wget -q -O - | \
gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/google.gpg --import; \
chmod 644 /etc/apt/trusted.gpg.d/google.gpg; \
echo "deb stable main" >> /etc/apt/sources.list.d/google.list; \
apt-get update -y; \
apt-get install -y google-chrome-stable; \
CHROME_VERSION=$(google-chrome --product-version | grep -o "[^\.]*\.[^\.]*\.[^\.]*"); \
wget -q --continue -P /chromedriver "$CHROMEDRIVER_VERSION/"; \
unzip /chromedriver/chromedriver* -d /usr/local/bin/
# To check it after (chrome and chromedriver versions will be the same):
$ docker run --rm -it put_docker_image_name_here bash
$ google-chrome --version
$ chromedriver -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment