我正在使用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