我正在使用 https://hub.docker.com/r/testcafe/testcafe/
运行我们的 Testcafe 项目,它工作正常,除了失败时无法创建屏幕截图目录,原因是:
Error: EACCES: permission denied, mkdir '/screenshots'
是否有可能完成这项工作,我是否遗漏了什么?
我试过:
--screenshots ./screenshots
和:
--screenshots {full path to directory}/screenshots
如何授予此 docker 容器的访问权限以写入主机上的目录以供将来引用?
最佳答案
最简单的解决方案是在您的 Docker 主机上创建一个 screenshots
目录,配置正确的权限并将此目录作为卷传递给容器。您可以使用以下命令作为引用:
mkdir screenshots
chmod a=rwx screenshots
docker run -it --rm -v ./tests:/tests -v ./screenshots:/screenshots testcafe/testcafe firefox /tests --screenshots /screenshots
关于docker - 使用 docker image testcafe/testcafe 时没有创建截图目录的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55260795/