![](/img/trans.png)
[英]Docker cp: Error response from daemon: lstat no such file or directory
[英]Circle CI docker cp file from instance to artifacts
我正在Docker上运行CircleCI,然后测试我的代码,在测试之后,测试覆盖率记录到了一个txt文件中,我想将其复制到工件文件夹中。
- run:
name: Run test coverage
command: |
docker-compose exec api mkdir /tmp_reports
docker-compose exec api coverage report > /tmp_reports/coverage_output.txt
docker cp api:/tmp_reports/coverage_output.txt /tmp/coverage_results
- store_artifacts:
path: /tmp/coverage_results
CircleCI错误
/bin/bash: line 1: /tmp_reports/coverage_output.txt: No such file or directory
Exited with code 1
我已经在本地运行并将文件从docker容器复制到了我的本地目录,但是circ ci似乎与此有关。 有人可以给我指出正确的方向吗,谢谢。
在脚本的第二行,将输出发送到文件> /tmp_reports/coverage_output.txt
,该文件将写入容器外部的文件。 输出的重定向由容器外部的bash处理。
因此,在第1行上,您在容器内创建目录,在第2行上,该目录失败,因为目录/tmp_reports
在容器外不存在。
您可以通过将所有3行替换为:
mkdir -p /tmp/coverage_results
docker-compose exec api coverage report > /tmp/coverage_results/coverage_output.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.