这是DockerFile。
FROM microsoft/aspnet:4.7
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .
这是错误。
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
我已将项目发布到obj / Docker / publish文件夹。
这是我的docker-compose文件。我从docker-compose.yml文件所在的文件夹中使用了docker-compose up命令。
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
最佳答案
我遇到过同样的问题。原来我犯了一个愚蠢的错误。我将以下内容添加到我的.dockerignore文件中,只是出于建立新项目的习惯:
bin
obj
.vs
.git
然后我尝试在我的Dockerfile中运行它
COPY ./bin/publish/ .
Docker给出了奇怪的tmp路径错误,因为自从我告诉它忽略/ bin文件夹以来,它就退回到了该路径。一旦我复制到其他发布路径(而不是bin),问题就消失了。
关于asp.net - 为什么docker build在我的复制路径前添加一个临时目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46982414/