yukinying / chrome-headless-browser-docker

Continuously building Chrome Docker image for Linux.
https://store.docker.com/community/images/yukinying/chrome-headless-browser/tags
Apache License 2.0
373 stars 53 forks source link

Can't use with M2 Mac #51

Open jaydee18 opened 1 year ago

jaydee18 commented 1 year ago

I'm getting this error when attempting to use the latest image on my M2 Macbook:

chrome The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

yukinying commented 1 year ago

Did you use the "Chrome Headless Browser Stable" image as described in the README.md?

celiolatorraca commented 1 year ago

I am also having the same issue

The container crashes at startup and the only log i get is:

Error: Can't open display:

Here's the command I am running in this case:

docker run -it -P --shm-size=1g -p 58192:58192 yukinying/chrome-headless-browser-stable:118.0.5993.70 --disable-datasaver-prompt --no-first-run --disable-extensions --remote-debugging-address=0.0.0.0 --remote-debugging-port=58192 --headless --disable-gpu --hide-scrollbars
yukinying commented 1 year ago

Please check the instructions in https://github.com/yukinying/chrome-headless-browser-docker#how-to-run-the-container. I think you would need to add the cap-add=SYS_ADMIN flag as said in the instruction.

i-kosh commented 1 year ago

m2 pro on our project we use this image to take screenshots of storybook components and i trying to investigate problem with rendering differences on x86 and arm platforms

so i tried to launch docker with --platform=linux/amd64 and ran into same issue Error: Can't open display: adding cap-add=SYS_ADMIN did not help

command i used

docker run --rm -it --platform=linux/amd64 --cap-add=SYS_ADMIN yukinying/chrome-headless-browser-stable:100.0.4896.127

needles to say the issue only occurs if i truing to run with --platform=linux/amd64, arm image (linux/arm64/v8) work fine, except rendering differences

upd: tried on latest - same

celiolatorraca commented 1 year ago

Still having the same issue I was already using cap-add=SYS_ADMIN,

Here's the exact command I run:

docker run --init -it --rm --name chrome --shm-size=1024m -p=127.0.0.1:9222:9222 --cap-add=SYS_ADMIN \
  yukinying/chrome-headless-browser-stable:latest

And the output is only:

Error: Can't open display: