Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run puppeteer with headless:false #169

Open
littlee opened this issue Apr 21, 2021 · 1 comment
Open

Unable to run puppeteer with headless:false #169

littlee opened this issue Apr 21, 2021 · 1 comment
Labels

Comments

@littlee
Copy link

littlee commented Apr 21, 2021

Describe the bug

(node:18) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
[29:29:0421/022508.111924:ERROR:browser_main_loop.cc(1390)] Unable to open X display.


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/app/node_modules/puppeteer/lib/Launcher.js:342:14)
    at ChildProcess.<anonymous> (/app/node_modules/puppeteer/lib/Launcher.js:332:60)
    at ChildProcess.emit (events.js:327:22)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)

To Reproduce
Dockerfile

FROM zenika/alpine-chrome:with-node

ENV CHROME_BIN="/usr/bin/chromium-browser"\
  PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"

WORKDIR /app

COPY --chown=chrome package.json .
COPY --chown=chrome .npmrc .

RUN npm install

ADD --chown=chrome . .

ENTRYPOINT ["tini", "--"]

CMD [ "npm", "run", "dev" ]

nodejs code

const browser = await puppeteer.launch({
      headless: false,
      executablePath: process.env.CHROME_BIN || undefined,
      args: ['--no-sandbox', '--disable-setuid-sandbox']
    });

What is the expected behavior?
chromium start normally

What is the actual behavior?
chromium failed to start
Possible solution

Logs
If applicable, add logs to help explain your problem.

Versions

Software Version(s) How-to
Chromium 89.0.4389.72 docker container run -it --rm --entrypoint "" zenika/alpine-chrome chromium-browser --version
Image sha256:7e3b38744596dacbd8d37491a206ab6fce1eb8bcbbff4b8314af92b154638887 docker image inspect --format='{{index .RepoDigests 0}}' zenika/alpine-chrome
Docker Engine 20.10.5 docker version

Additional context
Add any other context about the problem here.

@littlee littlee added the bug label Apr 21, 2021
@jlandure
Copy link
Owner

Hi @littlee 👋

Thanks for your issue! 👍
Have you try the example with puppeteer here: https://github.com/Zenika/alpine-chrome/tree/master/with-puppeteer ?

I remind you that this image objective is to get a chromium headless based docker image. (with no display)
FYI, here is an experiment with X11: https://github.com/Zenika/alpine-chrome/tree/master/examples/x11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants