playwright: [BUG] The official Docker image doesn't work with non root user
Context:
- Playwright Version: [what Playwright version do you use?] 1.0.2
- Operating System: [e.g. Windows, Linux or Mac] Linux Debian 10
- Node version: [e.g. 10.12, 10.14] 12
- Browser: [e.g. All, Chromium, Firefox, WebKit] All
- Extra: [any specific details about your environment] Docker I am running playwright in Docker using the exact docker image from your github repo Error
VError: a BeforeAll hook errored, process exiting: features/support/playwright.js:14: Failed to launch browser: Error: spawn /home/pwuser/.cache/ms-playwright/firefox-1089/firefox/firefox ENOENT
I think the problem comes from installing The browsers to /root folder: /root/.cache/ms-playwright/chromium-764964 and the user not being able to access them when running playwright.
> node install.js
chromium v764964 downloaded to /root/.cache/ms-playwright/chromium-764964
firefox v1089 downloaded to /root/.cache/ms-playwright/firefox-1089
webkit v1219 downloaded to /root/.cache/ms-playwright/webkit-1219
Code Snippet
global.browser = await pw.chromium.launch({ headless: process.env.HEADLESS !== "false" });
Describe the bug
Note that the same happens with chrome
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 22 (11 by maintainers)
@haikyuu is there a reason you want to copy everything and install under root rather than non-privileged user the tests are running under? Basically rearranging your docker file like this:
This way the browsers should go into
pwuserhome dir and the user should have permissions to access everything installed this way.This works. You guys are great. Thanks!
@tajo as @arjun27 pointed out you can build missing libjpeg from source, something like this should work:
This is not exactly libjpeg-turbo8 we are using but it should fix the missing dependency issue.
Sure, here is the exact Dockerfile
I don’t know what’s the problem. But i suspect it’s about the base image, since you’re using
bionicand i’m usingbuster.I would happily switch, but there is no
bionicofficial image for node. And manually installing node in popped up a lot ofEACCESSissues and was incompatible with our setup.Here is the command to use to run the docker container
docker run --rm -it <id> bash -ilHere is the last lines of the logs