Reputation: 31
Here is the DockerFile.
FROM microsoft/aspnet:4.7
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .
And here is the error.
Error
Building a.enterpriseextservices
Service 'a.enterpriseextservices' failed to build: COPY failed:
GetFileAttributesEx \\?\C:\Users\jesmiller-AM\AppData\Local\Temp\docker-
builder587295999\obj\Docker\publish: The system cannot find the file specified..
For more troubleshooting information, go to
http://aka.ms/DockerToolsTroubleshooting docker-compose C:\Program Files
(x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 349
I have published the project to the obj/Docker/publish folder. Here is my docker-compose file. I used the docker-compose up command from the folder where the docker-compose.yml file is located.
version: '3'
services:
a.web.familyconnection:
image: a.web.familyconnection
build:
context: .\FamilyConnection
dockerfile: Dockerfile
b.enterpriseextservices:
image: b.enterpriseextservices
build:
context: .\Framework\b.EnterpriseExtServices
dockerfile: Dockerfile
Upvotes: 2
Views: 2880
Reputation: 27027
I had the same issue. Turned out I made a silly mistake. I added the following to my .dockerignore file, just out of habit when setting up a new project:
bin
obj
.vs
.git
Then I tried running this in my Dockerfile
COPY ./bin/publish/ .
Docker gave the strange tmp path error, because it was falling back to that path since I told it to ignore my /bin folder. Once I copied to a different publish path (not bin), the problem went away.
Upvotes: 1
Reputation: 3662
It looks like your path to the folders, or where you've published your code at may be incorrect. The project should be published in the obj/Docker/publish
folder inside of the respective folders defined by context
Using an example docker-compose.yml
:
version: "3"
services:
foo:
build: ./foo
bar:
build: ./bar
And Dockerfile
:
FROM jaydorsey/ruby-2.4.1
COPY ${source:-obj/Docker/publish} .
And a tree structure like this:
.
├── Dockerfile
├── bar
│ └── Dockerfile
├── docker-compose.yml
├── foo
│ └── Dockerfile
└── obj
└── Docker
└── publish
When I run docker-compose build
I get the following error
Building foo
Step 1/2 : FROM jaydorsey/ruby-2.4.1
---> b79899b232f6
Step 2/2 : COPY ${source:-obj/Docker/publish} .
ERROR: Service 'foo' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder186649811/obj/Docker/publish: no such file or directory
This isn't identical to yours, since I'm running macOS, but very similar. You'll note the temporary file location (which is an internal Docker artifact of how it's copying files around) and the similarity in the docker-build<randomstring>
path
However, if I create the obj/Docker/publish
folders underneath each respective subfolder (context
), the docker-compose build
command works fine.
.
├── Dockerfile
├── bar
│ ├── Dockerfile
│ └── obj
│ └── Docker
│ └── publish
├── docker-compose.yml
├── foo
│ ├── Dockerfile
│ └── obj
│ └── Docker
│ └── publish
└── obj
└── Docker
└── publish
Please check that the folder you've published exists under the contexts as noted, and not in the root.
I still believe this is a path issue as noted in the error message. I hope this provides some context that helps you debug the root cause.
Can you please confirm your file & folder layout? I'm fairly certain it's path related because of the error message. I haven't done any Docker for Windows work either but I'd also double-check your default path using the correct slash (forward vs backward)
Upvotes: 0