最基本的 docker build 在 COPY 上失败

Jef*_*emi 1 docker dockerfile docker-image docker-for-windows

我第一次尝试从已编译的 VS 项目的可执行文件中构建 docker 映像。我不希望 docker 来构建我的项目(哦,没有考虑到我已经遇到的问题)。因此,我的应用程序源文件(和编译后的二进制文件)所在的文件夹中有以下 Dockerfile:

地点: d:\MyApp

Dockerfile 内容:

FROM microsoft/windowsservercore
COPY bin /app
ENTRYPOINT ["C:\\app\\x86\\Debug\\MyApp.exe"]
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

命令窗口:

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.
Run Code Online (Sandbox Code Playgroud)

如果我将 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
Run Code Online (Sandbox Code Playgroud)

Jef*_*emi 5

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