Docker-selenium: armhf docker image of Selenium

Created on 3 Jul 2020  路  16Comments  路  Source: SeleniumHQ/docker-selenium

馃殌 Feature Proposal

I am trying to run Selenium on RPi3 in a docker container and all the docker images that are available are of x86 architecture type. Henceforth I am willing to build a fully-featured arm7hf image for Selenium to be able to run on modern ARM devices (with some help from your side) if you feel this is viable enough.

Motivation

ARM is a fast-approaching architecture that is becoming better day by day with recent advancements. Selenium especially being quite popular with folks working in web automation and testing, if the framework can run on modern high-performance boards like RaspberryPi's then it would be extremely helpful to the community in general.

Superior web automation now becomes portable with ARM-based devices sounds like a great pitch.

Example

Build a fully-featured dockerfile for selenium that is compatible with ARM to build a docker image, we can either modify present components (recommended) or build a new one. Folks, wanting to run on Selenium on ARM devices, can easily pull the image and start working on it.

Ubuntu Bionic 18.04 has multi-arch support for armhf so we are sorted there for the base image.
Google-Chrome is not available on ARM, so we can use Chromium.
And, Chromium-Chromedriver as an alternative for chromedriver. That's the two major things that gets changed.

Let me know what you think folks! Happy to help to build this if it sounds viable enough.

enhancement

Most helpful comment

Does armhf run on arm64? (I'm guessing the reverse doesn't work, armv9 > armv7.)

I have multi-arch linux amd64/arm64 images for all the Selenium parts as well as Chromium and Firefox which work great on Docker for Mac on an M1 as linux/arm64, and on AWS Graviton2 instances as the same, and still work on linux/amd64 platform as well:

https://github.com/sj26/docker-selenium

They're currently pushed to Docker Hub here:

https://hub.docker.com/u/seleniarm

The main blocker seems to be getting good upstream browser binaries. The best I could find was Debian who build Chromium and Firefox across many platforms.

All 16 comments

@vipulgupta2048
Yeah, I guess over time there will be more interest in these images, but not having Chrome or ChromeDriver is less than ideal.
Additionally, I guess we need to compile the Selenium Server jar for ARM?

Thanks for replying @diemol
Can you explain why Chromium and Chromium-Chromedriver won't fit together and would be less than ideal for running Selenium? I understand everything is configured with taking Chrome and Chromedriver as a base but isn't there any way to run the alternatives.

Yes, Selenium server needs to be recompiled for ARM since it contains some non-JVM code. Otherwise, it might have just worked. How do you think I should go about this?

Well, people want to test on the same browser customers use. We know that Chromium is the base for Chrome, but in reality, people want to test with Chrome.

About Selenium jar, we need to figure out how to do it in a simple way. For now, the focus is Selenium 4 and after that is released, we can check this again. In general, this does not look as a simple thing to achieve.

@diemol Agreed to that, more users use Chrome so makes sense to take that. With your response, I thought Chromium wouldn't work at all even with a little tinkering.

About Selenium jar, at first, it seemed quite straightforward as we can just run the same Bazel build over on the ARM container. But, since Bazel is not available on ARM as a package to begin with. I am not sure how to proceed. Please do let me know if there is a way about how I can go implementing this at the moment. Anything would help at this point. Thanks!

@vipulgupta2048 yeah, right now we are still working towards a beta in Selenium 4, so no priority for this right now. I will comment back later.

Thanks @diemol appreciate it!
Happy to help, I have laid some groundwork for the same when i tried porting myself. Let me know I can share it over here when the time comes :+1:

Since apple silicon is released, this issue might be relevant for more users.

Currently selenium/standalone-chrome failed in my setup with "driver.version: unknown".
The selenium/standalone-firefox still works. I've build standaloneFirefox for arm64, which was pretty straightforward and give a decent preformance boost.

(Tested with DockerPreview7.)

+1 for relevancy. Just tried to run our tests this morning on Apple M1, and the same errors reported 6 days ago are there. I'll give standalone-firefox a look in the meantime.

Since apple silicon is released, this issue might be relevant for more users.

Currently selenium/standalone-chrome failed in my setup with "driver.version: unknown".
The selenium/standalone-firefox still works. I've build standaloneFirefox for arm64, which was pretty straightforward and give a decent preformance boost.

(Tested with DockerPreview7.)

Hello @henningn,
Can you explain to me how you did it? I get the same result between Chrome and Firefox on an Apple M1.

Best,
Thomas

@thomasphilibert,
I can use selenium/standalone-firefox:4.0.0-beta-1-prerelease-20201208 out of the box. It is slow but it works.

To build an arm image you have to ake some changes to the "Base"-Dockerfile and "NodeFirefox"-Dockerfile. (see https://github.com/henningn/docker-selenium-arm64/commit/c0f0f6440d735c7ef12b6f2c43e05e30a550fa42)

I've pushed the image to docker hub, where the amd64 version is the official one and the arm64 version is the self build version. You can find it here: https://hub.docker.com/repository/docker/henningn/selenium-standalone-firefox

I tried @henningn solutions with firefox, it didn't help. Then I tried to recreate Base and Hub images with arm64 ubuntu, same results.
From my perspective the problem is in Base and Hub images. When I run Hub on Linux amd64 machine i can browse to localhost:4444 and see Selenium page, but it doesn't work on arm machine (ports are exposed but response is empty).

BTW, no problems with running selenium with Chrome natively without Docker. I think we can manage it to run as expected in a container.

EDIT:
I was able to run Hub successfully. Now I can open localhost:4444 page. I have no idea why it didn't work previously. Now I think I can try to run firefox image.

Does armhf run on arm64? (I'm guessing the reverse doesn't work, armv9 > armv7.)

I have multi-arch linux amd64/arm64 images for all the Selenium parts as well as Chromium and Firefox which work great on Docker for Mac on an M1 as linux/arm64, and on AWS Graviton2 instances as the same, and still work on linux/amd64 platform as well:

https://github.com/sj26/docker-selenium

They're currently pushed to Docker Hub here:

https://hub.docker.com/u/seleniarm

The main blocker seems to be getting good upstream browser binaries. The best I could find was Debian who build Chromium and Firefox across many platforms.

@sj26 How did it go compiling the selenium docker images for the ARM architecture? I tried to pull from seleniarm but it seems the images are not published on Docker, unless I'm just missing something.

version: "3"
services:
  chrome0:
    image: seleniarm/node-chromium:4.0.0-beta-1-20210215
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - seleniarm-hub
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6900:5900"

  chrome1:
    image: seleniarm/node-chromium:4.0.0-beta-1-20210215
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - seleniarm-hub
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6901:5900"

  chrome2:
    image: seleniarm/node-chromium:4.0.0-beta-1-20210215
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - seleniarm-hub
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6902:5900"

  seleniarm-hub:
    image: seleniarm/hub
    container_name: seleniarm-hub:4.0.0-beta-1-20210215

    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"

I tried running a hub from here but it said:

$ docker-compose -f docker-compose-hub-arm64.yml up -d
Pulling seleniarm-hub (seleniarm/hub:)...
ERROR: manifest for seleniarm/hub:latest not found: manifest unknown: manifest unknown

What am I missing? Thanks.

I think I didn't publish a latest tag for seleniarm/hub sorry! Only 4.0.0-beta-1-20210215. I think the scripts still push 3.x series as latest.

https://hub.docker.com/r/seleniarm/hub/tags

@sj26 Thank you! Glad to be able to run my Docker Selenium Hub again! Here is my updated docker-compose:

version: "3"
services:
  chrome0:
    image: seleniarm/node-chromium:4.0.0-beta-1-20210215
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - seleniarm-hub
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6900:5900"

  chrome1:
    image: seleniarm/node-chromium:4.0.0-beta-1-20210215
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - seleniarm-hub
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6901:5900"

  chrome2:
    image: seleniarm/node-chromium:4.0.0-beta-1-20210215
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - seleniarm-hub
    environment:
      - SE_EVENT_BUS_HOST=seleniarm-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6902:5900"

  seleniarm-hub:
    image: seleniarm/hub:4.0.0-beta-1-20210215
    container_name: seleniarm-hub-4.0.0-beta-1-20210215

    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"

+1 for these images. It would be nice to run a selenium server on Raspberry Pi 4 using Docker.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Manolo2014 picture Manolo2014  路  3Comments

vikramvi picture vikramvi  路  6Comments

peterstory picture peterstory  路  4Comments

lluisteamcmp picture lluisteamcmp  路  6Comments

minhnguyenvan95 picture minhnguyenvan95  路  5Comments