使用 docker 图片 testcafe/testcafe 时没有创建截图目录的权限
No permissions to create screenshot directory when using docker image testcafe/testcafe
我正在使用 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
我正在使用 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