COPY上最基本的docker构建失败

时间:2018-06-11 23:14:01

标签: docker dockerfile docker-image docker-on-windows

我正在尝试为已经编译的VS项目的可执行文件中的第一次构建一个docker镜像。我不希望docker构建我的项目(哦,没有给出我已经存在的问题)。因此,我在我的应用程序源文件(和已编译的二进制文件)所在的文件夹中有以下Dockerfile:

地点:d:\MyApp

Dockerfile内容:

FROM microsoft/windowsservercore
COPY bin /app
ENTRYPOINT ["C:\\app\\x86\\Debug\\MyApp.exe"]

MyApp文件夹的内容:

MyApp\
MyApp\bin
MyApp\bin\x64
MyApp\bin\x64\Release
MyApp\bin\x64\Debug
MyApp\bin\x64\Release\* (lots of binaries)
MyApp\bin\x64\Debug\* (lots of binaries)
...
MyApp\Dockerfile

命令窗口:

d:\MyApp> docker image build .

Sending build context to Docker daemon 3.584kB
Step 1/3 : FROM microsoft/windowsservercore  ---> 4dba31379dad
Step 2/3 : COPY bin /app COPY failed: CreateFile \\?\C:\ProgramData\Docker\tmp\docker-builder196938557\bin: The system cannot find the file specified.

如果我将COPY行更改为COPY ./bin/*.* /app/

Sending build context to Docker daemon  3.584kB
Step 1/3 : FROM microsoft/windowsservercore
 ---> 4dba31379dad
Step 2/3 : COPY ./bin/*.* /app/
COPY failed: no source files were specified

1 个答案:

答案 0 :(得分:2)

不知怎的,我有一个带有“*”的“.dockerignore”。删除该行后,一切似乎都没问题。