I'm trying to install a specific version of chrome and chromedriver in my docker container to avoid version mismatch between the two. I feel the best way to go about it is to have both of them in my code and import them to the container and install.
This is where I'm right now
FROM eclipse-temurin:11
WORKDIR /app/
COPY bin/drivers/chromedriver /tmp/
COPY bin/drivers/google-chrome-stable_current_amd64.deb /tmp/
RUN apt-get install -y wget
RUN apt-get install -y /tmp/google-chrome-stable_current_amd64.deb
#RUN dpkg -i /tmp/google-chrome-stable_current_amd64.deb
#RUN apt -f install
RUN chmod 755 /tmp/chromedriver && \
ln -fs /tmp/chromedriver /usr/bin/chromedriver
RUN ls -la /usr/bin/chromedriver
RUN ls -la /usr/bin/
This google-chrome-stable_current_amd64.deb is for chrome version 90 and I'm getting a lot of dependency errors as below.
#10 0.674 Some packages could not be installed. This may mean that you have
#10 0.674 requested an impossible situation or if you are using the unstable
#10 0.674 distribution that some required packages have not yet been created
#10 0.674 or been moved out of Incoming.
#10 0.674 The following information may help to resolve the situation:
#10 0.674
#10 0.674 The following packages have unmet dependencies:
#10 0.677 google-chrome-stable : Depends: fonts-liberation but it is not installable
#10 0.677 Depends: libasound2 (>= 1.0.16) but it is not installable
#10 0.679 E: Unable to correct problems, you have held broken packages.
#10 0.681 Depends: libatk-bridge2.0-0 (>= 2.5.3) but it is not installable
#10 0.681 Depends: libatk1.0-0 (>= 2.2.0) but it is not installable
#10 0.681 Depends: libatspi2.0-0 (>= 2.9.90) but it is not installable
Then I saw chrome for testing, https://googlechromelabs.github.io/chrome-for-testing/. I thought I'll go with version 120 for both chrome and chromedriver. But instead of a .deb file I got the whole folder structure. How can I use it in my docker? Do I just need to place it in the correct path, if so where should i place it? What about the dependencies, do i need to take care of that?
Don't prefer to download the chrome and chromedriver from the internet, rather have it in my codebase.
Also please someone let me know if this is the correct way to go on about with chromedriver as well.
WORKDIR /app
COPY bin/drivers/chromedriver /tmp/
RUN chmod 755 /tmp/chromedriver && \
ln -fs /tmp/chromedriver /usr/bin/chromedriver
The image size is too big, would be nice to have it in alpine linux - amazoncorretto:11-alpine3.18
Thanks in advance!
This is the way I've been doing it:
FROM openjdk:17-slim
# please review all the latest versions here:
# https://googlechromelabs.github.io/chrome-for-testing/
ENV CHROMEDRIVER_VERSION=120.0.6099.71
### install chrome
RUN apt-get update && apt-get install -y wget && apt-get install -y zip
RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get install -y ./google-chrome-stable_current_amd64.deb
### install chromedriver
RUN wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROMEDRIVER_VERSION/linux64/chromedriver-linux64.zip \
&& unzip chromedriver-linux64.zip && rm -dfr chromedriver_linux64.zip \
&& mv /chromedriver-linux64/chromedriver /usr/bin/chromedriver \
&& chmod +x /usr/bin/chromedriver
###
# REST OF YOUR DOKCERFILE HERE
###
Basically, downloads and installs latest stable chromedriver version. Chromedriver version to be manually set using ENV (see https://googlechromelabs.github.io/chrome-for-testing/)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With