Jeff Saremi
Jeff Saremi

Reputation: 3004

The most basic docker build fails on COPY

I'm trying to build a docker image for this first time out of the exeutables for a VS project that is already compiled. I do not want docker to build my project (oh no given the problems I already have). As a result I have the following Dockerfile in the folder where my app source files (and compiled binaries) are:

Location: d:\MyApp

Dockerfile Contents:

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

Contents of MyApp folder:

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

Command window:

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.

If I change the COPY line to 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

Upvotes: 1

Views: 2669

Answers (1)

Jeff Saremi
Jeff Saremi

Reputation: 3004

Somehow I had a ".dockerignore" with a "*" in it. After removing that line everything seems to be ok.

Upvotes: 5

Related Questions