Setting up puppeteer in a docker environment using sail
Opened this issue · 3 comments
Joemires commented
Hello guys!
Please I need help with setting up my puppeteer in a docker environment
I'm using laravel sail and will appreciate having a container with chrome setup where I can connect my puppeteer to, I have seen someone do it with node, something like this:
chrome:
image: 'browserless/chrome'
ports:
- '${BROWSERLESS_CHROME_PORT:-3000}:3000'
networks:
- sail
environment:
- CONNECTION_TIMEOUT=-1
later in the code
const browser = await puppeteer.connect({
browserWSEndpoint: "ws://chrome:3000",
});
dsebastien commented
I'm also curious about this. @Joemires, did you manage to make it work?
Joemires commented
Yes I did @dsebastien
Your docker compose configuration
chrome:
image: 'browserless/chrome'
ports:
- '${BROWSERLESS_CHROME_PORT:-3000}:3000'
networks:
- sail
environment:
- CONNECTION_TIMEOUT=-1
later in the code
$client = $puppeteer->connect([
'browserWSEndpoint' => env('BROWSER_WS_ENDPOINT') ?: 'ws://localhost:300'
]);
Joemires commented
Yes I did @dsebastien Your docker compose configuration
chrome: image: 'browserless/chrome' ports: - '${BROWSERLESS_CHROME_PORT:-3000}:3000' networks: - sail environment: - CONNECTION_TIMEOUT=-1later in the code
$client = $puppeteer->connect([ 'browserWSEndpoint' => env('BROWSER_WS_ENDPOINT') ?: 'ws://localhost:300' ]);