
Instead, launch the browser with the -disable-dev-shm-usage flag: const browser = await puppeteer. Since Chrome 65, this is no longer necessary. To fix, run the container with docker run -shm-size=1gb to increase the size of /dev/shm. This is typically too small for Chrome and will cause Chrome to crash when rendering large pages. & mkdir -p /home/pptruser/Downloads /app \īy default, Docker runs a container with a /dev/shm shared memory space 64MB.

RUN addgroup -S pptruser & adduser -S -G pptruser pptruser \

RUN yarn add Add user so we don't need -no-sandbox. # Puppeteer v13.5.0 works with Chromium 100. PUPPETEER_EXECUTABLE_PATH =/usr/bin/chromium-browser We'll be using the installed package.ĮNV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD =true \ # Tell Puppeteer to skip installing Chrome. # Installs latest Chromium (100) package. The newest Chromium package supported on Alpine is 100, which corresponds to Puppeteer v13.5.0. There's a full example at that shows how to run this Dockerfile from a web server running on App Engine Flex (Node). name puppeteer-chrome puppeteer-chrome-linux \ Run the container by passing node -e "" as the command: docker run -i -init -rm -cap-add =SYS_ADMIN \ # Run everything after as non-privileged user.īuild the container: docker build -t puppeteer-chrome-linux. & chown -R pptruser:pptruser /package-lock.json & chown -R pptruser:pptruser /package.json \ & chown -R pptruser:pptruser /node_modules \ & chown -R pptruser:pptruser /home/pptruser \ & groupadd -r pptruser & useradd -r -g pptruser -G audio,video pptruser \ # same layer as npm install to keep re-chowned files from using up several hundred MBs more space

# Install puppeteer so it's available in the container.

# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true To work around this, try running without the flag: const browser = await puppeteer. Puppeteer passes -disable-extensions flag by default and will fail to launch when such policies are active. Some chrome policies might enforce running Chrome/Chromium with certain extensions. # Chrome headless doesn't launch on Windows
