“docker cp”所有文件从文件夹到现有容器文件夹 [英] "docker cp" all files from a folder to existing container folder
问题描述
我想将build(host)文件夹中的文件复制到html我的容器:
docker cp ./src/build b081dbbb679b:/ usr / share / nginx / html
要清楚;我需要从主机复制到容器。
但是它会复制整个构建文件夹并复制到..html / build
我只需要在构建文件夹中的文件(和子文件夹)复制到..html。
我缺少某些东西,或者我有复制每个文件一个一个?
下面是关于如何在docker中使用CP命令的解释,您的问题与 /。
在$ code> SRC_PATH
SRC_PATH不以/结尾。
将源目录复制到此目录中
SRC_PAPTH以/结尾。
将源目录的内容复制到此目录中
Am I missing something when I try to copy files from one folder to a existing container folder:
I want to copy files within the build(host) folder to html in my container:
docker cp ./src/build b081dbbb679b:/usr/share/nginx/html
To be clear; I need to copy from host to container.
But it copies the whole build folder and copies it to ..html/build
I just need the files(and sub folders) within the build folder to be copied into ..html.
Am I missing something or do I have to copy each file one by one?
Here is the explanation on how to use the CP command in docker, which will fix your issue with /.
in end of SRC_PATH
SRC_PATH does not end with /.
the source directory is copied into this directory
SRC_PAPTH does end with /.
the content of the source directory is copied into this directory
这篇关于“docker cp”所有文件从文件夹到现有容器文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!