puppeteer: [Bug]: Cannot execute chrome for testing in read only docker "--database is required"

Steps to reproduce

Dockerfile:

FROM node:18-slim
RUN npx @puppeteer/browsers install chrome@116.0.5793.0 --path /usr/bin/chrome-install

RUN apt-get update \
    && apt-get install -y wget gnupg dumb-init \
          ## chromium dependencies https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-doesnt-launch-on-linux
          ca-certificates \
          fonts-liberation \
          libasound2 \
          libatk-bridge2.0-0 \
          libatk1.0-0 \
          libc6 \
          libcairo2 \
          libcups2 \
          libdbus-1-3 \
          libexpat1 \
          libfontconfig1 \
          libgbm1 \
          libgcc1 \
          libglib2.0-0 \
          libgtk-3-0 \
          libnspr4 \
          libnss3 \
          libpango-1.0-0 \
          libpangocairo-1.0-0 \
          libstdc++6 \
          libx11-6 \
          libx11-xcb1 \
          libxcb1 \
          libxcomposite1 \
          libxcursor1 \
          libxdamage1 \
          libxext6 \
          libxfixes3 \
          libxi6 \
          libxrandr2 \
          libxrender1 \
          libxss1 \
          libxtst6 \
          lsb-release \
          wget \
          xdg-utils \
      && apt-get update

ENTRYPOINT [ "/bin/bash", "-c" ]

CMD ["bash"]

In the terminal:

$ docker build -t test-puppeteer -f Dockerfile . && docker run --read-only -it test-puppeteer   bash
## inside docker
$ /usr/bin/chrome-install/chrome/linux-116.0.5793.0/chrome-linux64/chrome

Expected results

I should be able to run the browser. Before chrome testing, I was using chromium and it was possible.

Actual results

I get the following error

chrome_crashpad_handler: --database is required
Try 'chrome_crashpad_handler --help' for more information.
Trace/breakpoint trap (core dumped)
root@27814e039735:/# 
exit

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 18 (1 by maintainers)

Most upvoted comments

We got this to work by setting in the environment:

XDG_CONFIG_HOME=/tmp/.chromium
XDG_CACHE_HOME=/tmp/.chromium

If anyone is coming to this issue because they encounter a Puppeteer/Chrome issue with the --database flag when running CI/CD on a Jenkins Pipeline + Docker on a linux host, then the solution from @sfc-gh-selee works. In my case:

XDG_CONFIG_HOME="$WORKSPACE@tmp/.chromium"
XDG_CACHE_HOME="$WORKSPACE@tmp/.chromium"