DEV Community

loading...

Cannot launch puppeteer browser instance in docker image

saiavinashiitr profile image Sai Avinash Duddupudi ・1 min read

Hi all,

I am trying a launch a headless chrome and perform some actions using puppeteer in my Nodejs code.

This works great(with npm start) but when I try to build Docker image from Docker file and run the image and execute the function, I get the following error.

(node:18) UnhandledPromiseRejectionWarning: Error: Unable to launch browser, error message: Failed to launch the browser process!
[0422/194052.772673:FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.

Enter fullscreen mode Exit fullscreen mode

So, after some search, I found that adding args: ["--no-sandbox"] during browser launch will solve the problem but still the same error keeps coming.

Here is my Dockerfile.
https://slack-files.com/T04MYU6C6-F01V3C7NQTX-6b82740d91

Please suggest a workaround

Discussion (0)

Forem Open with the Forem app