unwilling-turquoise
unwilling-turquoise•2y ago

The basic app works, but breaks in docker

Hello there! I've just started creating a project and followed the steps from the guide. The basic TS project created with npx crawlee create and playwright crawler works, however when I try to dockerize this app using the guide from https://crawlee.dev/docs/guides/docker-images it doesn't work. The only change I've done is that I've created a docker compose file with the following contents to make it a bit easier for me.
version: '3.8'

services:
demoapp:
build:
dockerfile: Dockerfile
ports:
- "8080:8080"
version: '3.8'

services:
demoapp:
build:
dockerfile: Dockerfile
ports:
- "8080:8080"
When I try to launch it, I get the following error:
! demoapp The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

INFO PlaywrightCrawler: Starting the crawler.
node:internal/process/esm_loader:108
internalBinding('errors').triggerUncaughtException(
^

Failed to launch browser. Please check the following:
- Try installing the required dependencies by running `npx playwright install --with-deps` (https://playwright.dev/docs/browsers).

The original error is available in the `cause` property. Below is the error received when trying to launch a browser:

browserType.launchPersistentContext: Target page, context or browser has been closed
Browser logs:
[...]

[cause]: browserType.launchPersistentContext: Target page, context or browser has been closed
! demoapp The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

INFO PlaywrightCrawler: Starting the crawler.
node:internal/process/esm_loader:108
internalBinding('errors').triggerUncaughtException(
^

Failed to launch browser. Please check the following:
- Try installing the required dependencies by running `npx playwright install --with-deps` (https://playwright.dev/docs/browsers).

The original error is available in the `cause` property. Below is the error received when trying to launch a browser:

browserType.launchPersistentContext: Target page, context or browser has been closed
Browser logs:
[...]

[cause]: browserType.launchPersistentContext: Target page, context or browser has been closed
Am I doing something wrong? Is it something wrong with the image? Is it not possible to run on mac with ARM and I need to emulate x64?
Running in Docker | Crawlee
Example Docker images to run your crawlers
9 Replies
unwilling-turquoise
unwilling-turquoiseOP•2y ago
Btw, the issue is the same if I launch it using just docker run
correct-apricot
correct-apricot•2y ago
I'm running crawlee on mac M2 in docker using following image: mcr.microsoft.com/playwright:v1.40.0-jammy and it works fine. I'm not using actors, just plain crawlee npm package.
lemurio
lemurio•2y ago
hi, which Docker image are you using? Have you tried using apify/actor-node-playwright image?
Lukas Krivka
Lukas Krivka•2y ago
Can you report it to Crawlee GitHub?
unwilling-turquoise
unwilling-turquoiseOP•2y ago
Hello Lukas, thanks, I already did 🙂 hey, yes, I've tried specific ones with chrome and firefox — same result
adverse-sapphire
adverse-sapphire•2y ago
@MightySeal, were you able to fix this? I am facing same problem.
unwilling-turquoise
unwilling-turquoiseOP•2y ago
@Kunal Verma are you using m1 mac? Turned out I didn't have rosetta emulation enabled for it.
adverse-sapphire
adverse-sapphire•2y ago
Yeah I am using M1 mac Oh okay, will enabling Rosetta emulation fix this problem in deployment too?
unwilling-turquoise
unwilling-turquoiseOP•2y ago
Not sure, I think it depends on environment. I have a linux vps, it works on it.

Did you find this page helpful?