我正在尝试“提升和转移”使用 MVC 3 编写的旧版 Web 服务(以及用于管理它的网站)。我使用了 Visual Studio“添加 - > docker 支持”功能,并且正在获取我的网站如果我手动连接到正在运行的容器并安装 MVC 3,则容器和网站将正常运行。我更愿意在构建容器时安装 MVC 3。
dockerfile 看起来像这样:
# escape=` (backtick)
FROM microsoft/aspnet:4.7.1-windowsservercore-1709
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .
RUN C:\inetpub\wwwroot\AspNetMVC3Setup.exe /q
dockerfile 的最后一行是不起作用的东西。我尝试了几种变体,但结果总是某种类型的路径未找到错误。
其他尝试语法的示例:
RUN ["C:\inetpub\wwwroot\AspNetMVC3Setup.exe", "/q"]
RUN ["powershell.exe", "C:\inetpub\wwwroot\AspNetMVC3Setup.exe", "/q"]
RUN ["powershell.exe", ".\AspNetMVC3Setup.exe", "/q"]
RUN [".\AspNetMVC3Setup.exe", "/q"]
RUN AspNetMVC3Setup.exe /q
当我连接到正在运行的容器时,路径和文件名是正确的,但是在构建过程中文件可能还没有真正存在吗?
作为容器构建的一部分,我如何运行 MVC 安装?
错误示例:
13>Step 5/5 : RUN C:\inetpub\wwwroot\AspNetMVC3Setup.exe /q
13> ---> Running in 3b7e8c30f2e0
13>[91mC:\inetpub\wwwroot\AspNetMVC3Setup.exe : The term
13>[0m[91m'C:\inetpub\wwwroot\AspNetMVC3Setup.exe' is not recognized as the name of a
13>cmdlet, function, script file, or operable program. Check the spelling of the
13>[0m[91mname, or if a path was included, verify that the path is correct and try again.
13>[0m[91mAt line:1 char:76
13>[0m[91m+ ... rence = 'SilentlyContinue'; C:\inetpub\wwwroot\AspNetMVC3Setup.exe /q
13>[0m[91m+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13> + CategoryInfo : ObjectNotFound: (C:\inetpub\wwwroot\AspNetMVC3Se
13> tup.exe:String) [], ParentContainsErrorRecordException
13> + FullyQualifiedErrorId : CommandNotFoundException
13>Step 5/5 : RUN ["C:\inetpub\wwwroot\AspNetMVC3Setup.exe", "/q"]
13> ---> Running in 7322410daf93
13>[91mAt line:1 char:77
13>[0m[91m+ ... ference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; [C:\inetp ...
13>+ ~
13>[0m[91mMissing ] at end of attribute or type literal.
13>[0m[91mAt line:1 char:78
13>+ ... ce = 'SilentlyContinue'; [C:\inetpub\wwwroot\AspNetMVC3Setup.exe, /q]
13>[0m[91m+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13>Unexpected token ':\inetpub\wwwroot\AspNetMVC3Setup.exe' in expression or
13>[0m[91mstatement.
13>At line:1 char:115
13>+ ... ce = 'SilentlyContinue'; [C:\inetpub\wwwroot\AspNetMVC3Setup.exe, /q]
13>+ ~
13>Missing argument in parameter list.
13> + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordEx
13> ception
13>[0m[91m + FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute
13>
13>Service 'adminmanagement' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; ["C:\inetpub\wwwroot\AspNetMVC3Setup.exe", "/q"]' returned a non-zero code: 1
13>[0m
13>Step 5/5 : RUN ["powershell.exe", "C:\inetpub\wwwroot\AspNetMVC3Setup.exe", "/q"]
13> ---> Running in 44113a1005d2
13>[91mUnable to find type [powershell.exe,C:\inetpub\wwwroot\AspNetMVC3Setup.exe,
13>/q]. Details: The given assembly name or codebase was invalid. (Exception from
13>HRESULT: 0x80131047)
13>At line:1 char:76
13>[0m[91m+ ... yContinue'; [powershell.exe, C:\inetpub\wwwroot\AspNetMVC3Setup.exe, ...
13>[0m[91m+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13> + CategoryInfo : InvalidOperation: (powershell.exe,...C3Setup.exe
13> , /q:TypeName) [], ParentContainsErrorRecordException
13>[0m[91m + FullyQualifiedErrorId : TypeNotFoundWithMessage
13>[0m[91m
13>Service 'adminmanagement' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; ["powershell.exe", "C:\inetpub\wwwroot\AspNetMVC3Setup.exe", "/q"]' returned a non-zero code: 1
13>[0m