Issue running chrome driver in docker image Issue running chrome driver in docker image selenium selenium

Issue running chrome driver in docker image


You appear to have copied a chromedriver binary built for MacOS into a Debian machine.Based on how you've tagged this question with macos and the image python:3.9.5-slim-buster you are using is amd64 based on Debian.

I suggest you continue persisting with trying to curl the Linux 64 bit chromedriver into your machine via your Dockerfile.

To test it in your host OS you can simply change your current chromedriver binary to chromedriver.bakup. Download the linux version to chromedriver and rebuild your docker machine and it will copy the linux version into the new image.


Looks like you have been using chromedriver binary for MacOS instead of its linux version.

To make it a 'workable' piece of code, you can try linux binary and perform volume mapping when you try to run your docker image. Use the linux binary for chromedriver and put it in a seperate directory in your system which needs to be mapped. And when you run your image try using:

docker run -v <directory_path_to_chromedriver>:<docker_image_directory_path> <image>

Your final piece of code will be updated with your new binary file path.

browser = webdriver.Chrome("<docker_image_directory_path>/chromedriver",options = chr_options)

But for permanent fix, curl and unzip the linux binary while you build the docker image.


After going through the comments, I believe you're a little confused with Docker containers and how they interact with your system.

A Docker container runs it's own independent, isolated and optimised version of an operating system determined by the FROM layer, and leverages your system's kernel.

Now, you must use Chrome Webdriver binaries compatible with linux arm64, rightly pointed out by @Shubham and @lgflorentino. It seems that you've already done so.

Your next steps should be to check permissions on the Chrome Webdriver executables, and make sure that your container has setup all the environment paths and variables correctly.

You can do so by entering your container with the command docker exec -it /bin/bash or /bin/sh and then manually execute your bins. This will give you a clearer picture.

Check your environment variables as well!Also, an improved Dockerfile with reduced number of layers can be as well.

FROM python:latest#Use a deterministic Python image, mention a version instead of 'latest'WORKDIR /Users/ufomammut/Documents/eplrestapiCOPY requirements.txt requirements.txtRUN pip3 install -r requirements.txt && \    curl https://chromedriver.storage.googleapis.com/90.0.4430.24/chromedriver_linux64.zip -O && \    unzip chromedriver_linux64.zip COPY . .#Try adding an ENV layer to make sure your paths are setup properly. (After debugging your container)CMD [ "python3", "epl.py"]