asp.net - 为什么docker build在我的复制路径前添加一个临时目录?

标签 asp.net docker docker-compose dockerfile docker-for-windows

这是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/

相关文章:

ASP.NET Web.config 加密 - 无法访问临时文件

MySql.数据.MySqlClient.MySqlException : Incorrect datetime value

c# - 无法将 linq 结果隐式转换为 View 模型列表

angular - Docker 绑定(bind)安装卷不会传播 Angular `ng serve` 执行所监视的更改事件

docker - 使用外部网络连接 docker 容器

隐藏/取消隐藏面板的 JavaScript 函数

docker - F# 类型是否可以与容器化 (Docker) 资源一起使用?

python - 从python运行docker容器

docker - 如何在 docker Ubuntu 镜像上验证谷歌云 SDK?

docker - 尝试将 GitLab-CE docker 容器连接到 OpenLDAP docker 容器