简体   繁体   English

剧作家 docker 内置 bitbucket 管道权限被拒绝

[英]Playwright docker build in bitbucket pipelines permission denied

We have this Dockerfile:我们有这个 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:当我们尝试构建时,在 bitbucket 管道(又使用图像 docker:20.10.8-alpine3.13)期间发生此错误:

...
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.在本地它可以工作,但在管道中,即使我在 /proc/tty/driver 文件夹中执行一个简单的“ls”命令,它也会因权限被拒绝而崩溃。

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!!谢谢!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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