使用docker image testcafe / testcafe时无权创建屏幕截图目录

问题描述 投票:3回答:1

我正在使用https://hub.docker.com/r/testcafe/testcafe/

运行我们的Testcafe项目,它的工作原理除了失败后,由于以下原因无法创建截图目录:

Error: EACCES: permission denied, mkdir '/screenshots'

是否有可能使这项工作,我错过了什么?

我试过了:

--screenshots ./screenshots 

和:

--screenshots {full path to directory}/screenshots

如何访问此docker容器以写入主机上的目录以供将来参考?

docker automated-tests e2e-testing web-testing testcafe
1个回答
3
投票

最简单的解决方案是在Docker主机上创建screenshots目录,配置正确的权限并将此目录作为卷传递给容器。您可以使用以下命令作为参考:

mkdir screenshots

chmod a=rwx screenshots

docker run -it --rm -v ./tests:/tests -v ./screenshots:/screenshots testcafe/testcafe firefox /tests --screenshots /screenshots
© www.soinside.com 2019 - 2024. All rights reserved.