[英]Send file from container to host
This is what I tried: 这是我尝试的:
Dockerfile: Dockerfile:
ENTRYPOINT go test ./tests -v .>/outputs/report.txt
Command line: 命令行:
docker run test -v /outputs:/outputs
I expect that the newly generated report.txt will be available in the host in the same directory. 我希望新生成的report.txt将在同一目录的主机中可用。 What am I missing here?
我在这里想念什么?
I think that you almost made it. 我认为您几乎做到了。
Try to map the volume before image name. 尝试在映像名称之前映射该卷。
Instead: docker run test -v /outputs:/outputs
相反:
docker run test -v /outputs:/outputs
Use: docker run -v /outputs:/outputs test
使用:
docker run -v /outputs:/outputs test
This command will bind your local /outputs
with the /outputs
in the container. 此命令会将您的本地
/outputs
与容器中的/outputs
绑定。 And remember, all commands after image name will pass a command
to the container. 记住,映像名称后的所有命令都将
command
传递给容器。
For more information see: Docker run command docs and Docker volume docs 有关更多信息,请参阅: Docker run command docs和Docker volume docs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.