docker cp 命令用于在Docker容器之间复制文件或目录。
举例说明: 假设一个运行的容器ID为9a28f199688e,想要将本地文件/path/to/local-file 复制到容器中的 /path/to/destination 目录中。
执行命令如下:
docker cp /path/to/local-file 9a28f199688e:/path/to/destination
还可以使用 -a 选项来递归复制整个目录:
docker cp -a /path/to/local-directory 9a28f199688e:/path/to/destination
这将把本地目录 /path/to/local-directory 中的所有文件和子目录复制到容器的 /path/to/destination 目录中。
请注意,容器必须已经启动并且必须在运行中才能使用docker cp 命令。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有