Closed davorb closed 2 years ago
Could you provide more details?
Hi, here's the output you get when trying to run the image on M1 Mac:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
clone: Invalid argument
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Happy to provide any other details if needed.
I don't have an M1, but I found some related discussions for people who are using M1 with docker. I haven't verified but there are suggestions from other forums that you may use the docker binary that support "Mac with Apple chip" in https://hub.docker.com/editions/community/docker-ce-desktop-mac?tab=description. That should solve the "does not match the detected host platform (linux/arm64/v8)" issue.
I suspect the "no specific platform was requested" would also be resolved together, but I cannot verify.
Unfortunately this does not help, I have Docker Desktop for Mac with Apple chip installed and I am getting this error.
It looks like the solution for this is https://www.docker.com/blog/multi-arch-build-what-about-travis/. I would need to run a few test to make sure the image is of minimal size. This would probably take some time.
If you need to run the image on M1 shortly, I would recommend you build the image by yourself using the build procedure in https://github.com/yukinying/chrome-headless-browser-docker/blob/master/.travis.yml#L18
Hello! Is there are any changes for support M1 chip?
I managed to run the image using --platform=linux/amd64
.
It still breaks with
clone: Invalid argument
I don't know the reason for this error. Can anyone help?
@yukinying Would you consider moving from google-chrome-unstable to the open source chromium?
As i understand correclty, the main problem is there are no chrome with arm architecture support. So in that case if we also change os build for docker -> we have a problems with unsupported deb packages. So if chrome will be released with arm architecture, so we can start it on ubuntu arm server and docker container will'be started.
I solved it by running docker
with colima
using the architecture x86_64
.
The command is colima start --arch x86_64
This solves the issue 100%. The image runs smooth on the M1 Mac and the cross-architecture issue will be solved automatically when/if Chrome releases the arm64 version for linux.
I hope this helps other people with this issue.
@cesar-carrera-nutmeg Are you able to provide some detailed steps to reproduce? Thanks
This is a summary of what I've done (I'm not reproducing them right now, so I hope they're accurate).
Using colima
github:abiosoft/colima on a M1, the architecture that matches the system is aarch64
, which is also the default architecture.
When you try to run docker run -it yukinying/chrome-headless-browser
it will install the linux/arm64
version, which doesn't have a build of google-chrome-unstable
available and therefore breaks (it will work if using chromium, which I tested building the Dockerfile)
When adding the platform like docker run -it --platform=linux/amd64 yukinying/chrome-headless-browser
it will install the linux/amd64
version and it will manage to start, but will still fail with that clone: Invalid argument
which I don't know what's related to (probably some cross-architecture issue).
So I had to run colima stop
and colima destroy
to stop and destroy the virtual machine, and then run colima start --arch x86_64
. This time the virtual machine will not be matching the linux/arm64
. So when running docker run -it yukinying/chrome-headless-browser
it will success to boot.
This was enough to solve my issue, as I was coming from github:oblador/loki - issue#344 - Loki unable to run Docker image on M1 Mac. But I believe it will be enough to solve this issue for anyone that lands here.
Are there any updates on this?
Sadly that last proposal didn't work for me :/
No updates yet. Sorry this is pure procrastination on my side. I have been thinking I don't have an M1 so I am not able to test, and was thinking the proposal above would work for some people.
Nevertheless, I am planning to push a new image and then see if it would work for M1. If it work, then I will see how to add it back to the original image.
It turns out that the package used (google-chrome-unstable) is not pre-built for ARM64, so I end up using debian's chromium (which is updated less frequently).
Could you verify if the image yukinying/chrome-headless-browser-stable:latest-arm64
works? If it would work, I need to figure out how to automate the build for it.
https://hub.docker.com/layers/chrome-headless-browser-stable/yukinying/chrome-headless-browser-stable/latest-arm64/images/sha256-f954a5c05e61e8fadb7dfef67556b494f368a053277369651ecd06adf40b7829?context=explore is the image page in docker hub.
@yukinying I just tried it out and it seems to be working. I just get this error at the end Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
, but I think it is unrelated
Glad that it works. Then it makes sense to look at automating it now.
For the error you see, you may check https://github.com/yukinying/chrome-headless-browser-docker#why-cap-addsys_admin-is-needed. There are other reference of that in the Internet about that error.
Now the docker image build is automated. I have updated README to show that there is a new stable image available, and that should work for M1. Please re-open if it does not work.
Are there any plans to upgrade it to make it work?