如何在Docker中将文件从一个文件夹复制到容器中的另一个文件夹? [英] How can I copy a file from one folder to another folder within a container in Docker?

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

问题描述

我已经找到了在主机和容器之间移动文件的方法,但是无法弄清楚如何使用YML在同一容器内移动文件。有人可以帮我吗?

I already found ways for moving file between host and container but was not able to figure out on how to moves files within same container using YML. Can some one help me on this?

推荐答案

您可以使用 ssh 命令。首先找到每个docker容器的IP,然后将ssh放入一个终端以传输文件。

You can use ssh command. First find IP of each docker container and then ssh into one terminal to transfer file.

man scp
The very basic usage:

scp remote_user@remote_host:/path/to/remote/file /path/to/local/file
and vice versa:

scp /path/to/local/file remote_user@remote_host:/path/to/remote/file

这篇关于如何在Docker中将文件从一个文件夹复制到容器中的另一个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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