docker复制文件到宿主机
时间: 2023-10-10 14:15:05 浏览: 201
在Docker中,要将文件从容器复制到宿主机,可以使用以下命令:docker cp \[容器名称或ID\]:\[容器内文件路径\] \[宿主机目标路径\]。例如,如果要将容器名为redis的容器中的配置文件复制到宿主机的/home/docker/redis/conf目录下,可以使用以下命令:docker cp redis:/data/appendonly.aof /home/docker/redis/conf。这样就可以将容器中的文件复制到宿主机中了。\[1\]
#### 引用[.reference_title]
- *1* [Docker运维系列 | 使用docker cp命令将容器中文件复制到宿主机,宿主机中文件复制到容器](https://blog.csdn.net/qq_37781649/article/details/106017232)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [如何从Docker中拷贝文件到宿主机](https://blog.csdn.net/Rainbow_Dream88/article/details/123073872)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [docker从容器里面拷文件到宿主机或从宿主机拷文件到docker容器里面](https://blog.csdn.net/weixin_30302609/article/details/96488759)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文