Docker Community Forums

Share and learn in the Docker community.

COPY failed trying to install plain Asp.Net MVC app to a container

This scenario seems very basic. After Docker is installed (18.06.0-ce)

  1. Start Vs2017
  2. Create new asp.net mvc project
  3. Try to install it the project to a Docker container.

The output is below. The full file path in the error does not, in fact, exist. But who would create that? The path segment docker-builder439407661 does not sound like something a user would create. Where does that come from? Am I supposed to create the magic path segment manually? Actually, I created that full path, it didn’t help.

Any ideas?
Note: I’m doing this from an Active Directory Domain joined machined in my workplace.

Getting Docker containers ready…
docker-compose -f “D:\temp\dockerwebapi\dockerwebapi\docker-compose.yml” -f “D:\temp\dockerwebapi\dockerwebapi\docker-compose.override.yml” -f “D:\temp\dockerwebapi\dockerwebapi\obj\Docker\docker-compose.vs.debug.g.yml” -p dockercompose4733329686020691249 --no-ansi build
The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
Building dockerwebapi
Step 1/2 : FROM microsoft/aspnet
latest: Pulling from microsoft/aspnet
Digest: sha256:ebbaf320b4dd0492079490fb83b3788925087987fde955cd5d4c32d82e9ce5f0
Status: Downloaded newer image for microsoft/aspnet:latest
—> 6ca2a1990fce
Step 2/2 : COPY ./bin/Release/Publish/ /inetpub/wwwroot
Service ‘dockerwebapi’ failed to build: COPY failed: CreateFile \?\C:\ProgramData\Docker\tmp\docker-builder439407661\bin\Release\Publish: The system cannot find the path specified.
A non-critical error occurred while getting containers ready. Your project will continue to function normally. The error was: The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
Building dockerwebapi
Service ‘dockerwebapi’ failed to build: COPY failed: CreateFile \?\C:\ProgramData\Docker\tmp\docker-builder439407661\bin\Release\Publish: The system cannot find the path specified…

Addendum, the COPY and ADD commands in the Dockerfile always fail in the same way. Even without using Visual Studio at all. The file below just tries to copy a simple directory of files

The FROM instruction specifies the base image. You are

extending the microsoft/aspnet image.

FROM microsoft/aspnet

The final instruction copies the site you published earlier into the container.

ADD /code/html/mwf-combo /inetpub/wwwroot

docker build -t dockerwebapi .

PS C:\temp> docker build -t dockerwebapi .
Sending build context to Docker daemon 3.197MB
Step 1/2 : FROM microsoft/aspnet
—> 6ca2a1990fce
Step 2/2 : ADD /code/html/mwf-combo /inetpub/wwwroot
ADD failed: CreateFile \?\C:\ProgramData\Docker\tmp\docker-builder293491541\code\html\mwf-combo: The system cannot find the path specified.

More information:
I discovered that if I put the built output (aka the Visual Studio filesystem ‘Published’ folder) in a directory that only contains the Dockerfile and the site then docker build will work. So the file system looks like this

c:\temp\dockerwebapitest\Dockerfile
c:\temp\dockerwebapitest\site\(mvc published output is in this folder)

And, the Dockerfile looks like this
# The FROM instruction specifies the base image. You are
# extending the microsoft/aspnet image.

FROM microsoft/aspnet

# The final instruction copies the site you published earlier into the container.
ADD ./site /inetpub/wwwroot

So it looks like Visual Studio DOcker integration has generated a configuration that does not work with the latest builds of Docker. Too bad. I’ll try to find place to file bugs.

1 Like