Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: Can build, but cannot run, Dockerfile in repo #255

Open
bjornlll opened this issue Jan 6, 2025 · 4 comments
Open

macOS: Can build, but cannot run, Dockerfile in repo #255

bjornlll opened this issue Jan 6, 2025 · 4 comments
Labels
triage This ticket will be looked at shortly

Comments

@bjornlll
Copy link

bjornlll commented Jan 6, 2025

Description

Docker file builds, but doesn't run, on macOS. It errors out with ECONNREFUSED when running tests

macOS version: 15.1.1 (24B91)

✅ Building (works well)

docker build --platform linux/amd64 -t puppeteer-real-browser-project .

[+] Building 67.8s (15/15) FINISHED                                                             docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                            0.0s
 => => transferring dockerfile: 1.13kB                                                                          0.0s
 => [internal] load .dockerignore                                                                               0.0s
 => => transferring context: 2B                                                                                 0.0s
 => [internal] load metadata for docker.io/library/node:latest                                                  1.0s
 => [ 1/10] FROM docker.io/library/node:latest@sha256:1745a99b66da41b5ccd6f7be3810f74ddab16eb4579de10de378adb5  0.0s
 => [internal] load build context                                                                               0.0s
 => => transferring context: 2.98kB                                                                             0.0s
 => CACHED [ 2/10] RUN npm config set registry https://registry.npmjs.org/                                      0.0s
 => CACHED [ 3/10] RUN npm cache clean --force                                                                  0.0s
 => CACHED [ 4/10] RUN apt-get update && apt-get install -y     wget     gnupg     ca-certificates     apt-tra  0.0s
 => CACHED [ 5/10] RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -       0.0s
 => CACHED [ 6/10] WORKDIR /app                                                                                 0.0s
 => [ 7/10] COPY package*.json ./                                                                               0.0s
 => [ 8/10] RUN npm update                                                                                     60.6s
 => [ 9/10] RUN npm install                                                                                     5.1s 
 => [10/10] COPY . .                                                                                            0.1s 
 => exporting to image                                                                                          0.9s 
 => => exporting layers                                                                                         0.9s 
 => => writing image sha256:1862119aefcd025ab3ae040a30b340ed6e8ad26083c02d34a40c4d1cbfc0c611                    0.0s
 => => naming to docker.io/library/puppeteer-real-browser-project                                               0.0s

What's Next?
  View summary of image vulnerabilities and recommendations → docker scout quickview

🚨 Running (doesn't work)

docker run --platform linux/amd64 puppeteer-real-browser-project

> [email protected] cjs_test
> node ./test/cjs/test.js

✖ DrissionPage Detector (26085.288304ms)
  Error: connect ECONNREFUSED 127.0.0.1:33935
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1634:16) {
    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 33935
  }

Full steps to reproduce the issue

On macOS, in terminal:

  • git clone https://github.com/zfcsoftware/puppeteer-real-browser
  • cd puppeteer-real-browser
  • docker build --platform linux/amd64 -t puppeteer-real-browser-project .
  • docker run --platform linux/amd64 puppeteer-real-browser-project

Issue Type

Bug, Build/Install

Operating System

Mac OS

Do you use Docker?

Docker

@bjornlll bjornlll added the triage This ticket will be looked at shortly label Jan 6, 2025
@bjornlll
Copy link
Author

bjornlll commented Jan 6, 2025

Another observation: Docker Desktop hangs while the ECONNREFUSED messages are being produced. The terminal process does not terminate using CTRL+C. If you restart Docker Desktop it will, after a long time, kill the terminal process.

TL;DR: Both terminal and Docker Desktop (perhaps also docker itself) hangs.

@bjornlll
Copy link
Author

bjornlll commented Jan 6, 2025

Spun up an x86 VM through Vultr, works fine there. Probably a macOS-specific problem, then.

docker run --platform linux/amd64 puppeteer-real-browser-project

> [email protected] cjs_test
> node ./test/cjs/test.js

✖ DrissionPage Detector (884.647825ms)
  Error: net::ERR_NAME_NOT_RESOLVED at https://drissionpage.pages.dev/
      at navigate (/app/node_modules/rebrowser-puppeteer-core/lib/cjs/puppeteer/cdp/Frame.js:184:27)
      at async Deferred.race (/app/node_modules/rebrowser-puppeteer-core/lib/cjs/puppeteer/util/Deferred.js:36:20)
      at async CdpFrame.goto (/app/node_modules/rebrowser-puppeteer-core/lib/cjs/puppeteer/cdp/Frame.js:150:25)
      at async CdpPage.goto (/app/node_modules/rebrowser-puppeteer-core/lib/cjs/puppeteer/api/Page.js:574:20)
      at async TestContext.<anonymous> (/app/test/cjs/test.js:34:5)
      at async Test.run (node:internal/test_runner/test:932:9)
      at async startSubtestAfterBootstrap (node:internal/test_runner/harness:297:3)

✔ Brotector, a webdriver detector (4889.166181ms)
✔ Cloudflare WAF (7982.198052ms)
✔ Cloudflare Turnstile (5227.5375ms)
✔ Fingerprint JS Bot Detector (6553.113378ms)
✔ Datadome Bot Detector (4225.283898ms)
✔ Recaptcha V3 Score (hard) (10483.602899ms)

@rdvo
Copy link

rdvo commented Jan 7, 2025

any ideas whats causing it for mac?

@bjornlll
Copy link
Author

bjornlll commented Jan 8, 2025

@rdvo I read somewhere that due to the way Docker handles its network virtual <-> host network connections on Mac that this has been known to sometimes connectivity issues. Don't know if that's the cause, though, and did not have time to go deeper. The error above could just as likely be the wrong Chrom(e|ium) binary being used and refusing to launch, I guess.

TD;DR: Don't know.

For my own purposes I'm now running a dockerized version of this on Vultr + interacting remotely with the dockerized version by setting DOCKER_HOST. That is good enough for my use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage This ticket will be looked at shortly
Projects
None yet
Development

No branches or pull requests

2 participants