为asp.net应用程序生成dokcer图像时出现生成错误

时间:2018-12-25 17:24:41

标签: asp.net docker asp.net-web-api2 containers dockerfile

我创建了一个简单的ASP.NET Web API(4.5.2框架)应用程序。

这是我使用文件>新建>项目> Web> Asp.net Web应用程序并选择ASP.NET Web Api选项创建的简单项目。

我正在尝试创建Docker映像,但出现以下错误。

这是我的脚本

#escape=`

# get the build agent image to build the project
FROM sixeyed/msbuild:netfx-4.5.2-webdeploy As build-agent

WORKDIR C:\Users\jason\source\repos\FirstApp\FirstApp
COPY FirstApp\packages.config .
RUN nuget restore packages.config -PackagesDirectory ..\packages

COPY FirstApp\ C:\Users\jason\source\repos\FirstApp\FirstApp
RUN msbuild FirstApp.csproj /p:OutputPath=c:\out /p:DeployOnBuild=true `
 /p:VSToolsPath=C:\MSBuild.Microsoft.VisualStuio.Web.targets.14.0.0.3\tools\VSToolsPath

#docker image build --tag firstapp --file .\Dockerfile .

# now build the app
FROM microsoft/aspnet:windowsservercore
SHELL ["powershell"]

WORKDIR c:\web-app
RUN Remove-Website -Name  'Default Web Site'; `
    New-Website -Name 'web-app' -Port 80 -PhysicalPath 'C:\web-app'

copy --from=build-agent c:\out\_PublishedWebsites\FirstApp c:\web-app

我遇到以下错误:

Step 10/11 : RUN Remove-Website -Name  'Default Web Site';  New-Website -Name 'web-app' -Port 80 -PhysicalPath 'C:\web-app'
 ---> Using cache
 ---> e37d8f12a4f7
Step 11/11 : copy --from=build-agent c:\out\_PublishedWebsites\FirstApp c:\web-app
docker : COPY failed: CreateFile \\?\Volume{ffe73e3d-cc0b-11e8-a943-00155d1c3a78}\out\_PublishedWebsites\FirstApp: The system cannot find the path specified.
At line:1 char:1
+ docker image build --tag firstapp --file .\Dockerfile .
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (COPY failed: Cr...path specified.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

我查找并发现,没有c:\ out文件夹。执行此命令后,我也看不到该文件夹​​:

RUN msbuild FirstApp.csproj /p:OutputPath=c:\out /p:DeployOnBuild=true `
 /p:VSToolsPath=C:\MSBuild.Microsoft.VisualStuio.Web.targets.14.0.0.3\tools\VSToolsPath

enter image description here

似乎是一个简单的问题,但是我不确定在哪里可以看到日志以及如何解决此问题。

0 个答案:

没有答案
相关问题