Docker - 将文件从容器复制到主机 [英] Docker - copy file from container to host

查看:177
本文介绍了Docker - 将文件从容器复制到主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用docker在CI服务器上构建依赖项,我不必在代理本身上安装所有的运行时和库。为了实现这一点,我需要将构建在容器内的构建文件复制到主机中。



可以吗?

解决方案

为了将文件从容器复制到主机,可以使用命令

  docker cp< containerId>:/ file / path / within / container / host / path / target 


I'm thinking of using docker to build my dependencies on a CI server, to that I don't have to install all the runtimes and libraries on the agents themselves. To achieve this I would need to copy the build artefacts that are built inside the container back into the host.

Is that possible?

解决方案

In order to copy a file from a container to the host, you can use the command

docker cp <containerId>:/file/path/within/container /host/path/target

这篇关于Docker - 将文件从容器复制到主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆