DEV Community

Sai Avinash Duddupudi
Sai Avinash Duddupudi

Posted on

Cannot launch puppeteer browser instance in docker image

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

Top comments (1)

Collapse
 
aathith_r profile image
AATHITH RAJENDRAN

If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox. They have mentioned it as dangerous. any other option we can use?