【问题标题】:The most basic docker build fails on COPY最基本的 docker 构建在 COPY 上失败
【发布时间】:2018-11-21 06:24:19
【问题描述】:

我第一次尝试从已编译的 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

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

    • 感谢您指向 .dockerignore!就我而言,它不是“*”,但“!bin\Release\Publish*”行中有错字
    猜你喜欢
    • 2020-05-03
    • 1970-01-01
    • 2019-08-13
    • 2017-07-14
    • 2020-06-15
    • 1970-01-01
    • 1970-01-01
    • 2019-12-25
    相关资源
    最近更新 更多