firefox fails when running in docker container
See original GitHub issueDiscussed in https://github.com/microsoft/playwright/discussions/13716
<div type='discussions-op-text'>Originally posted by Nedilko April 24, 2022
I faced with problem when I run screenshot tests with matching snapshot (.toMatchSnapshot
).
I’m running tests on Apple M1, and screenshots renders under darwin.
Everything okay, second attempt pf running test passes all tests.
BUT!
The problem when after this I run tests in my ci.
Tests not pass because they run under another file system, and screenshots has different name:
screenshot_name-browser-linux
- on CIscreenshot_name-browser-darwin
- on Apple M1 So, I tried to use this instructions:
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.21.0-focal /bin/bash
npm install
npx playwright test --update-snapshots
But unfortunately firefox tests fails: (btw, all firefox tests, not only screenshot tests)
pw:browser <launching> /ms-playwright/firefox-1322/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-rUXIAt -juggler-pipe -silent +0ms
pw:browser <launched> pid=371 +3ms
pw:browser [pid=371][err] *** You are running in headless mode. +424ms
pw:browser [pid=371][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.658892) [GFX1-]: glxtest: libpci missing +228ms
pw:browser [pid=371][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.658892) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.658951) [GFX1-]: glxtest: Unable to open a connection to the X server +0ms
pw:browser [pid=371][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.658892) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.658951) |[2][GFX1-]: glxtest: libEGL initialize failed (t=0.658962) [GFX1-]: glxtest: libEGL initialize failed +0ms
pw:browser [pid=371][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.658892) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.658951) |[2][GFX1-]: glxtest: libEGL initialize failed (t=0.658962) |[3][GFX1-]: No GPUs detected via PCI (t=0.658971) [GFX1-]: No GPUs detected via PCI +0ms
pw:browser [pid=371][out] +194ms
pw:browser [pid=371][out] Juggler listening to the pipe +0ms
pw:browser [pid=371][out] console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /tmp/playwright_firefoxdev_profile-rUXIAt/search.json.mozlz4", (void 0))) +41ms
```</div>
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
headless Firefox in Docker Container without root fails to start
3276.0 Safari/537.36 Steps to reproduce: I have a Firefox installed in a CentOS Docker Image. ``` FROM centos:7 USER root #needed for headless...
Read more >selenium - Cannot open firefox in Docker container
I am trying to run a selenium test inside a Docker container. I created the image on top of a base image of...
Read more >Firefox in Docker, failed in isolation
While experimenting with docker, I realized I can run a browser in a container for improved security. I managed to start with a...
Read more >How to run firefox inside docker container
Generally, if you run firefox inside docker container you will get the below error. [root@1c3a22e43538 /]# firefox Failed to open connection ...
Read more >Use the TestCafe Docker Image | Advanced Guides
TestCafe provides a preconfigured Docker image with Chromium and Firefox installed. ... Use the docker run command to run TestCafe in the Docker...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m running into (what I assume is) this same issue.
I’m using the docker image to run tests on Jenkins. Chrome and Webkit both work, but Firefox always goes to a 30 second timeout. The same issue occurs with or without xvfb-run.
Logs with xvfb-run:
Logs without xvfb-run:
(Had some weird formatting from the Jenkins logs so I’ve tried to clear that up as best I can)
Running with the same settings on my Linux workstation the image performs flawlessly, but it seems something in the docker image is still dependent on the host when it comes to running Firefox.
Thanks for the response! Actually I was watching video where you was showing new features of playwright v1.20 and noticed I have a reply on this issue form you 😃
tests just failed again… output below:
Maybe it’s a good idea to create own container with all needs. e.g. based on ubuntu image with installed all libraries, and of course playwright browsers… maybe something wrong with image which is build on Apple M1… I don’t know… I thought it’s a good idea to use VSCode remote development in containers, so that I need to configure docker file and after install all need dependencies and that’s it… And then I can configure ci to run e2e tests on exactly same system using same container. But I think the idea of image
mcr.microsoft.com/playwright:v1.21.0-focal
was pretty much same.