seleniumhq-community / docker-seleniarm

Multi-Arch (arm64/armhf/amd64) Docker images for the Selenium Grid Server
https://hub.docker.com/u/seleniarm
Other
248 stars 24 forks source link

[🐛 Bug]: Unable to install older Chromium versions #15

Closed dryu99 closed 2 years ago

dryu99 commented 2 years ago

What happened?

I'm trying to use older versions of Chromium in my Selenium Grid setup, however when I try setting an older version in the NodeChromium Dockerfile I get the following error:

E: Version '<sample_stable_version>-1' for 'chromium' was not found

Where I've been using https://chromium.cypress.io/ to pick stable versions. If installing older versions doesn't work through through apt-get, would it be possible to install an older version manually in the image if I have the binary? When I run dpkg -L chromium to see what files are installed I get this:

/.
/etc
/etc/chromium
/etc/chromium/master_preferences
/etc/chromium/policies
/etc/chromium/policies/recommended
/etc/chromium/policies/recommended/duckduckgo.json
/etc/chromium.d
/etc/chromium.d/README
/etc/chromium.d/apikeys
/etc/chromium.d/default-flags
/etc/chromium.d/extensions
/usr
/usr/bin
/usr/bin/chromium
/usr/lib
/usr/lib/chromium
/usr/lib/chromium/chrome_100_percent.pak
/usr/lib/chromium/chrome_200_percent.pak
/usr/lib/chromium/chromium
/usr/lib/chromium/locales
/usr/lib/chromium/locales/en-US.pak
/usr/lib/chromium/resources.pak
/usr/share
/usr/share/applications
/usr/share/applications/chromium.desktop
/usr/share/bug
/usr/share/bug/chromium
/usr/share/bug/chromium/control
/usr/share/bug/chromium/presubj
/usr/share/chromium
/usr/share/chromium/initial_bookmarks.html
/usr/share/doc
/usr/share/doc/chromium
/usr/share/doc/chromium/NEWS.Debian.gz
/usr/share/doc/chromium/README.Debian
/usr/share/doc/chromium/TODO.Debian
/usr/share/doc/chromium/changelog.Debian.gz
/usr/share/doc/chromium/copyright
/usr/share/gnome-control-center
/usr/share/gnome-control-center/default-apps
/usr/share/gnome-control-center/default-apps/chromium.xml
/usr/share/icons
/usr/share/icons/hicolor
/usr/share/icons/hicolor/128x128
/usr/share/icons/hicolor/128x128/apps
/usr/share/icons/hicolor/128x128/apps/chromium.png
/usr/share/icons/hicolor/16x16
/usr/share/icons/hicolor/16x16/apps
/usr/share/icons/hicolor/16x16/apps/chromium.png
/usr/share/icons/hicolor/24x24
/usr/share/icons/hicolor/24x24/apps
/usr/share/icons/hicolor/24x24/apps/chromium.png
/usr/share/icons/hicolor/256x256
/usr/share/icons/hicolor/256x256/apps
/usr/share/icons/hicolor/256x256/apps/chromium.png
/usr/share/icons/hicolor/32x32
/usr/share/icons/hicolor/32x32/apps
/usr/share/icons/hicolor/32x32/apps/chromium.png
/usr/share/icons/hicolor/48x48
/usr/share/icons/hicolor/48x48/apps
/usr/share/icons/hicolor/48x48/apps/chromium.png
/usr/share/icons/hicolor/64x64
/usr/share/icons/hicolor/64x64/apps
/usr/share/icons/hicolor/64x64/apps/chromium.png
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/chromium
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/chromium.1.gz
/usr/share/pixmaps
/usr/share/pixmaps/chromium.png

And when I download a chromium package from https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux/, the following files are present:

./libGLESv2.so
./nacl_irt_x86_64.nexe
./product_logo_48.png
./nacl_helper
./chrome_200_percent.pak
./v8_context_snapshot.bin
./vk_swiftshader_icd.json
./xdg-settings
./ClearKeyCdm/_platform_specific/.DS_Store
./ClearKeyCdm/_platform_specific/linux_x64/libclearkeycdm.so
./ClearKeyCdm/.DS_Store
./.DS_Store
./locales/ar.pak
./locales/gu.pak.info
./locales/en-US.pak
./locales/bn.pak.info
./locales/ta.pak.info
./locales/lt.pak
./locales/tr.pak
./locales/te.pak
./locales/ru.pak.info
./locales/sl.pak.info
./locales/lv.pak
./locales/mr.pak
./locales/hi.pak.info
./locales/zh-TW.pak
./locales/en-XA.pak
./locales/ms.pak.info
./locales/mr.pak.info
./locales/ms.pak
./locales/ml.pak.info
./locales/fr.pak.info
./locales/nl.pak
./locales/vi.pak.info
./locales/id.pak.info
./locales/nb.pak.info
./locales/pt-PT.pak.info
./locales/sr.pak.info
./locales/bn.pak
./locales/pt-BR.pak.info
./locales/vi.pak
./locales/ta.pak
./locales/zh-TW.pak.info
./locales/de.pak.info
./locales/zh-CN.pak
./locales/ja.pak.info
./locales/lt.pak.info
./locales/ja.pak
./locales/hi.pak
./locales/tr.pak.info
./locales/en-GB.pak
./locales/ar.pak.info
./locales/pl.pak
./locales/sw.pak
./locales/fa.pak
./locales/uk.pak.info
./locales/el.pak
./locales/sv.pak
./locales/he.pak.info
./locales/sr.pak
./locales/en-GB.pak.info
./locales/es-419.pak
./locales/fr.pak
./locales/fa.pak.info
./locales/ru.pak
./locales/sk.pak.info
./locales/am.pak.info
./locales/gu.pak
./locales/id.pak
./locales/fil.pak
./locales/ca.pak.info
./locales/et.pak.info
./locales/sk.pak
./locales/ro.pak
./locales/lv.pak.info
./locales/es.pak
./locales/fil.pak.info
./locales/ko.pak
./locales/hu.pak
./locales/kn.pak
./locales/fi.pak
./locales/hu.pak.info
./locales/da.pak
./locales/sl.pak
./locales/de.pak
./locales/en-XA.pak.info
./locales/ar-XB.pak.info
./locales/it.pak
./locales/ar-XB.pak
./locales/th.pak.info
./locales/bg.pak.info
./locales/hr.pak
./locales/he.pak
./locales/pt-PT.pak
./locales/kn.pak.info
./locales/ko.pak.info
./locales/et.pak
./locales/cs.pak
./locales/cs.pak.info
./locales/fi.pak.info
./locales/nb.pak
./locales/am.pak
./locales/ml.pak
./locales/el.pak.info
./locales/te.pak.info
./locales/it.pak.info
./locales/pl.pak.info
./locales/uk.pak
./locales/ro.pak.info
./locales/da.pak.info
./locales/es-419.pak.info
./locales/zh-CN.pak.info
./locales/nl.pak.info
./locales/bg.pak
./locales/es.pak.info
./locales/th.pak
./locales/ca.pak
./locales/pt-BR.pak
./locales/sw.pak.info
./locales/sv.pak.info
./locales/hr.pak.info
./locales/en-US.pak.info
./libvulkan.so.1
./chrome_100_percent.pak
./icudtl.dat
./resources/.DS_Store
./resources/inspector_overlay/main.js
./resources/inspector_overlay/inspector_overlay_resources.grd
./nacl_helper_bootstrap
./chrome-wrapper
./chrome_crashpad_handler
./MEIPreload/preloaded_data.pb
./MEIPreload/manifest.json
./resources.pak
./chrome
./chrome_sandbox
./libEGL.so
./swiftshader/libGLESv2.so
./swiftshader/libEGL.so
./libvk_swiftshader.so
./xdg-mime

There doesn't seem to be a 1-1 mapping of files from the apt-get and manual installation, I'm assuming I don't need every file to be present except for some important ones such as the chromium binary. Would it be enough to just rename chrome -> chromium? Or maybe there's more I'm missing and it's not that straightforward. If anyone has any thoughts on this please let me know, regardless thanks for all your work on this fork!

Command used to start Selenium Grid with Docker

Dockerfile is exactly the same except for the specified chromium version

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# NOTE: DO *NOT* EDIT THIS FILE.  IT IS GENERATED.
# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FROM seleniarm/node-base:4.4.0-20220814
LABEL authors=SeleniumHQ

USER root

# Install Chromium 
# RUN echo "deb http://http.us.debian.org/debian/ stable non-free contrib main" >> /etc/apt/sources.list \
RUN echo "deb http://deb.debian.org/debian/ sid main" >> /etc/apt/sources.list \
  && apt-get update -qqy \
  # && apt-get -qqy install chromium=89.0.4389.82-1 \
  # && apt-get -qqy install chromium=103.0.5060.134-1 \
  # && apt-get -qqy install chromium=93.0.4577.82-1 \
  # && apt-get -qqy install chromium=97.0.4692.71-0.1 \
  # && apt-get -qqy install chromium=98.0.4758.102-1+b1 \
  # && apt-get -qqy install chromium \
  && apt-get -qqy install chromium=103.0.5060.134-1 \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/*

#=================================
# Chromium Launch Script Wrapper
#=================================
COPY wrap_chromium_binary /opt/bin/wrap_chromium_binary
RUN /opt/bin/wrap_chromium_binary

#============================================
# Chromium webdriver
#============================================
RUN apt-get update -qqy \
  && apt-get -qqy install chromium-driver \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/*

RUN echo "chromium" > /opt/selenium/browser_name

USER 1200

Relevant log output

docker build -t seleniarm/node-chromium-old NodeChromium/
Sending build context to Docker daemon  9.728kB
Step 1/9 : FROM seleniarm/node-base:4.1.4-20220429
 ---> 28cb7b5bc0af
Step 2/9 : LABEL authors=SeleniumHQ
 ---> Using cache
 ---> 3dc7f7bbb3fe
Step 3/9 : USER root
 ---> Using cache
 ---> 0016f1003f99
Step 4/9 : RUN echo "deb http://deb.debian.org/debian/ sid main" >> /etc/apt/sources.list   && apt-get update -qqy   && apt-get -qqy install chromium=103.0.5060.114-1   && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
 ---> Running in edd8f594afdb
E: Version '103.0.5060.114-1' for 'chromium' was not found
The command '/bin/sh -c echo "deb http://deb.debian.org/debian/ sid main" >> /etc/apt/sources.list   && apt-get update -qqy   && apt-get -qqy install chromium=103.0.5060.114-1   && rm -rf /var/lib/apt/lists/* /var/cache/apt/*' returned a non-zero code: 100
root@linux-1:~/docker-seleniarm# docker build -t seleniarm/node-chromium-v103 NodeChromium/

Operating System

Ubuntu

Docker Selenium version (tag)

seleniarm-v4.4.0-20220814

dryu99 commented 2 years ago

Nevermind, figured it out! Although I couldn't use apt-get to install older Chromium versions, I was able to copy over downloaded packages from https://chromium.cypress.io/ into specific paths to get it working. I also had to create a symlink so seleniarm would be able to execute the binary properly.

COPY ./chrome-linux /usr/lib/chromium/
RUN chmod -R +x /usr/lib/chromium/

# create symlink for binary
RUN ln -s /usr/lib/chromium/chrome /usr/bin/chromium

# other instructions...

COPY ./chromedriver_linux64/chromedriver /usr/bin/chromedriver
RUN chmod +x /usr/bin/chromedriver