alpine-chrome: Crashes on Apple Silicon

Describe the bug On Apple Silicon, Chromium will crash on launch with the following message:

app_1 | Error: Protocol error (Target.setDiscoverTargets): Target closed.

app_1 | at /usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:71:63

app_1 | at new Promise (<anonymous>)

app_1 | at Connection.send (/usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:70:16)

app_1 | at Function.create (/usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js:95:26)

app_1 | at ChromeLauncher.launch (/usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js:101:56)

app_1 | at processTicksAndRejections (internal/process/task_queues.js:93:5)

To Reproduce

  1. Execute $ docker-compose up --build -d
  2. See error

What is the expected behavior? Chrome not to crash

What is the actual behavior? Chrome crashes

Possible solution Not sure –– hoping someone here might know what’s going on

Logs If applicable, add logs to help explain your problem.

Versions

  • Chromium: Chromium 86.0.4240.111
  • Image: zenika/alpine-chrome@sha256:2847c4e24af279ee12eea011ba9f669dd92adf317d01fcf3a7a51f88f8a8214b Docker Engine: 20.10.1
  • Puppeteer: 5.5.0

Additional context This happens very rarely when running the program locally. When running through the image, this happens every time.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 36 (9 by maintainers)

Most upvoted comments

I only have Apple Silicon so that’s all I can test at the moment! Lol

The issue doesn’t exist when running outside the docker image (npm start), and it doesn’t exist when deploying to a Google Cloud Run server. So it seems to only be Docker on macOS AS.

I can run that example container just fine. And I can also run the alpine-chrome container as well - I just get an error when making calls to puppeteer in the container.

I’ll poke the puppeteer folks as it might be an issue with the library - I’m not sure!

Ah! Thank you. Just found https://github.com/Zenika/alpine-chrome/issues/33 too. My bad, apologies. My multi-arch image builds work good in that case.

Yes, you’re right. This repository’s images (zenika/*) do not provide ARM builds. But the source image you had mentioned that you modified isn’t required is what I mean.

the only difference is the very first line FROM arm64v8/alpine:latest, everything else in the Dockerfile is identical.

So we can continue using alpine:latest as the source image and we have to build the same Dockerfile for multiple platforms. I use this command to build the Dockerfile for multiple platforms - docker buildx build --platforms=linux/arm64,linux/amd64 ..

So effectively we just need to rebuild the same Dockerfile for ARM.

Note: Some Dockerfiles here like puppeteer need some customization which I’ll be looking into once I fix my PHP rebuild 😃

I was running into crashes using my new MacBook M1 Air whereas my previous Intel MacBook had no issues. Ended up building my own version of this with an arm64v8 alpine image and my crash issue was resolved. You can find the image at avidtraveler/alpine-chrome.