VPS参考测评推荐
专注分享VPS主机优惠信息
衡天云优惠活动
华纳云最新优惠促销活动
jtti最新优惠促销活动

linux下怎么将文件复制到docker容器中

locvps
主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情!
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作

linux怎么文件复制docker容器中?很多人都不太了解,今天小编为了让大家更加了解linux,所以给大家总结了以下内容,一起往下看吧。

How to copy files to the docker container under Linux? Many people don't know much about it. Today, in order to let you know more about Linux, I summarized the following contents for you. Let's look down.

1、查看所有的docker容器

1. View all docker containers

docker ps

Docker PS

// 775c7c9ee1e1为docker中的id

//775c7c9ee1e1 is the ID in docker

docker exec -it 775c7c9ee1e1 /bin/bash

docker exec -it 775c7c9ee1e1 /bin/bash

2、从linux系统拷贝文件到容器

2. Copy files from Linux system to container

得到容器的长ID

Get the long ID of the container

// python为docker容器内运行的项目

//Python is the name of the project running in the docker container

docker inspect -f '{{.ID}}' python

docker inspect -f '{{.ID}}' python

然后进行拷贝 ,注意:执行docker命令时一定要退出容器,否则报错

Then copy it. Note: when executing the docker command, you must exit the container, otherwise an error will be reported

从容器中拷出来是一样的,docker cp 后面的位置调换一下即可,复制时可不用长路径,docker ps显示的容器名称即可使用

It's the same when copying from the container. Just change the location after docker CP. you don't need a long path when copying. The container name displayed by docker PS can be used

// docker cp 本地路径 容器长ID:容器路径

//Docker CP local path container long ID: container path

docker cp /usr/local/test.txt 38ef22f922704b32cf2650407e16b146bf61c221e6b8ef679989486d6ad9e856:/usr/local/tomcat/webapps test.txt

docker cp /usr/local/test.txt 38ef22f922704b32cf2650407e16b146bf61c221e6b8ef679989486d6ad9e856:/usr/local/tomcat/webapps test.txt

以上就是linux下怎么将文件复制到docker容器中做了简略的介绍,当然详细使用上面的不同还得要大家自己使用过才领会。如果想了解更多,欢迎关注主机参考行业资讯频道哦!

The above is a brief introduction of how to copy files to the docker container under Linux. Of course, the detailed use of the above differences should be understood only after you have used them. If you want to learn more, please pay attention to the host reference industry information channel!

--------------------------------------------------------------
主机参考,收集国内VPSVPS测评主机测评云服务器虚拟主机独立服务器,国内外服务器高性价比建站主机相关优惠信息@zhujicankao.com
详细介绍和测评国外VPS主机,云服务器,国外服务器,国外主机的相关优惠信息,商家背景,网络带宽等等,也是目前国内最好的主机云服务器VPS参考测评资讯优惠信息分享平台

这几篇文章你可能也喜欢:

本文由主机参考刊发,转载请注明:linux下怎么将文件复制到docker容器中 https://zhujicankao.com/14098.html

【腾讯云】领8888元采购礼包,抢爆款云服务器 每月 9元起,个人开发者加享折上折!
打赏
转载请注明原文链接:主机参考 » linux下怎么将文件复制到docker容器中
主机参考仅做资料收集,不对商家任何信息及交易做信用担保,购买前请注意风险,有交易纠纷请自行解决!请查阅:特别声明

相关推荐

评论 抢沙发

评论前必须登录!