简体   繁体   中英

Playwright docker build in bitbucket pipelines permission denied

We have this Dockerfile:

FROM mcr.microsoft.com/playwright:v1.20.0-focal
ADD ./sometest.e2e.spec.js /
RUN yarn add playwright && \
    PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install && \
    yarn add @playwright/test
RUN PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers ./node_modules/playwright/node_modules/.bin/playwright test

When we try to build, during bitbucket pipelines (which in turn uses the image docker:20.10.8-alpine3.13) this error happens:

...
Step 4/4 : RUN PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers ./node_modules/playwright/node_modules/.bin/playwright test
 ---> Running in d8a3b2a2d013
[Error: EACCES: permission denied, scandir '/proc/tty/driver'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/proc/tty/driver'
}

Locally it works, but in pipelines, even if I do a simple "ls" command in the /proc/tty/driver folder it crashes with permission denied.

Any tips? Thank you!

I was using root directory, I created a non root directory and the problem was solved!

FROM mcr.microsoft.com/playwright:v1.25.0-focal
RUN mkdir /playwright
ADD ./sometest.e2e.spec.js /playwright
RUN cd /playwright && \
    yarn add playwright && \
    PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install && \
    yarn add @playwright/test
RUN cd /playwright && PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers ./node_modules/playwright/node_modules/.bin/playwright test

Thank you!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM