如何将文件从服务器复制到Docker容器 [英] How to copy files from server to docker container
问题描述
我正在尝试创建Windows Nano Server容器并将某些文件从服务器复制到新容器。以下是我的dockerfile代码:
I am trying to create a Windows Nano Server container and copy some files from server to the new container. Below is my dockerfile code:
FROM microsoft/nanoserver
MAINTAINER test@gmail.com
COPY C:/files/ C:/files/
运行它时,出现以下错误:
When I run it, I am getting below error:
复制失败:createFile
\c:\programdata\Docker\tmp\docker-builder78565487文件:系统
无法找到指定的路径。
Copy failed:createFile \?\c:\programdata\Docker\tmp\docker-builder78565487\files: The system canot find the path specified.
如何在<$ c $中声明源位置c> COPY 命令,因此它使用绝对路径并将文件复制到容器上的 c:\文件位置。
How do I declare source location in COPY
command, so it uses absolute path and copy files to c:\files location on my container.
推荐答案
您不能在构建上下文之外复制文件。将需要复制的文件移动到 dockerfile
所在的文件夹中。
https://docs.docker.com/engine/reference/builder /#copy
You can not copy files outside of context of the build. Move files which needs to be copied in the same folder where dockerfile
is.
https://docs.docker.com/engine/reference/builder/#copy
这篇关于如何将文件从服务器复制到Docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!