
-disable-setuid-sandbox – disabled setui sandbox.-disable-dev-shm-usage – prevents from using shared RAM ( /dev/shm/).-disable-gpu – disables GPU hardware acceleration (which is usually not available when running in Docker).

There are a few more options that might be worth exploring if launching Puppeteer inside a container fails: Luckily, this no longer seems to be the case – it is possible now to launch puppeteer with the -no-sandbox option as a non-privileged user. In the past the -no-sandbox option required running Puppeteer as root, only increasing the risk. Unfortunately, running without a sandbox appears to be currently the only way to run Puppeteer inside a Docker container.

Sandbox is a security feature and running without a sandbox is generally discouraged. Supported, but failed: errno = Operation not permitted Otherwise it will crash with the following error messageįailed to move to new namespace: PID namespaces supported, Network namespace Chromium is not able to provide sandboxing when running inside a container so it needs to be launched at least with the -no-sandbox argument. Puppeteer will not launch in a Docker container without additional configuration.

Moving to the node:16-bullseye base image allows installing a much newer version of Chromium ( 1.124) where this is no longer a problem. Unfortunately this version doesn’t work in a Docker container – it just hangs indefinitely. If you use this base image the only version of Chromium you will be able to install with apt-get is. Most notably the node:16 image is based on buster. Some node Docker images are based on old distributions that contain only older versions of Chromium. Problem 2: The base image installs an old version of Chromium This will significantly reduce the time needed to install node modules. This can be solved by installing Chromium with apt-get install chromium -y and telling Puppeteer to use it by passing the executablePath: '/usr/bin/chromium' to the launch() function as follows:ĮNV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

Unfortunately, Chromium does not currently provide an arm build that works on Raspberry Pi and running stock Puppeteer on Raspberry Pi will end up with a crash. Puppeteer by default downloads a matching version of Chromium which is guaranteed to work out of the box on supported platforms. Problem 1: Chromium included in Puppeteer does not work on Raspberry Pi There are a few issues that make it harder than usual. Unfortunately, doing so on Raspberry Pi is not straightforward. These benefits might be why you’d want to run Puppeteer inside a Docker container. This is extremely useful for automating website testing, generating screenshots and PDFs of web pages or programmatic form submission.ĭocker offers numerous benefits including a standardized environment, isolation, and rapid deployment to name a few. Puppeteer is a Node.js module that allows interacting with a (headless) web browser programmatically.
