在Docker for Windows上将MSI复制到Container

时间:2018-03-04 18:26:49

标签: windows docker dockerfile

我在Windows Server 2016上有一个基本的ASP.NET核心应用程序。该应用程序在构建时成功运行Docker但是我试图修改dockerFile以将MSI从我的本地开发工作站复制到容器然而,当它建成时;我不断收到大量错误。基本上我在我的开发工作站C:\驱动器上有一个代理存储库,它包含本地工作站驱动器上的所有代理,我想将它复制到我的容器中。

Dockerfile位于Visual Studio项目的根目录中。如何将开发工作站中的外部文件添加到本地驱动器?

这是我的dockerFile ..

FROM microsoft/aspnetcore:2.0-nanoserver-sac2016 AS base

WORKDIR C:/Users/Administrator/Desktop/agents

COPY dotNetAgentSetup64-4.4.1.1765.msi C:/temp
COPY sample.xml C:/temp

WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0-nanoserver-sac2016 AS build
WORKDIR /src
COPY *.sln ./
COPY KevinSampleWeb/KevinSampleWeb.csproj KevinSampleWeb/
RUN dotnet restore
COPY . .
WORKDIR /src/KevinSampleWeb
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .

RUN msiexec /i C:\temp\dotNetAgentSetup64-4.4.1.1765.msi /q /norestart /lv %TEMP%\AgentInstaller.log AD_SetupFile=C:\temp\sample.xml INSTALLDIR=C:\AppDynamics DOTNETAGENTFOLDER=C:\AppDynamics
ENTRYPOINT ["dotnet", "KevinSampleWeb.dll"]

我得到的错误如下:

Severity    Code    Description    Project    File    Line    Suppression State
Error        COPY failed: CreateFile \\?\C:\ProgramData\Docker\tmp\docker-builder274108128\Users\Administrator\Desktop\agents\dotNetAgentSetup64-4.4.1.1765.msi: The system cannot find the path 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    366    

构建日志

----- Build started: Project: docker-compose, Configuration: Debug Any CPU ------
docker ps --filter "status=running" --filter "name=dockercompose8141175318702830198_kevinsampleweb_" --format {{.ID}} -n 1
KevinSampleWeb -> C:\Users\Administrator\source\repos\KevinSampleWeb\KevinSampleWeb\bin\Debug\netcoreapp2.0\KevinSampleWeb.dll
docker build -f "C:\Users\Administrator\source\repos\KevinSampleWeb\KevinSampleWeb\Dockerfile" --target "base" -t "kevinsampleweb:dev" "C:\Users\Administrator\source\repos\KevinSampleWeb"
Sending build context to Docker daemon  2.469MB
Step 1/5 : FROM microsoft/aspnetcore:2.0-nanoserver-sac2016 AS base
 ---> b142ce66755a
Step 2/5 : COPY C:/Users/Administrator/Desktop/agents/dotNetAgentSetup64-4.4.1.1765.msi C:/temp
COPY failed: CreateFile \\?\C:\ProgramData\Docker\tmp\docker-builder274108128\Users\Administrator\Desktop\agents\dotNetAgentSetup64-4.4.1.1765.msi: The system cannot find the path specified.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(366,5): error : COPY failed: CreateFile \\?\C:\ProgramData\Docker\tmp\docker-builder274108128\Users\Administrator\Desktop\agents\dotNetAgentSetup64-4.4.1.1765.msi: The system cannot find the path specified..
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(366,5): error : 
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(366,5): error : For more troubleshooting information, go to http://aka.ms/DockerToolsTroubleshooting
Done building project "docker-compose.dcproj" -- FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

0 个答案:

没有答案