簡體   English   中英

在 docker 容器上安裝 msi

[英]Installing msi on a docker container

在 dockerizing 遺留應用程序方面需要幫助 我有一個遺留應用程序,其中包含多個組件(msi 安裝程序)。 這些組件使用各種技術,如 C#、windows 窗體、C++、MFC、.net 遠程處理、C# webservices(asmx)。 在這些組件中,有幾個是桌面 ui 應用程序。 我正在研究 dockerizing 這些組件的可行性。 我知道無法從 docker 容器顯示 UI,但 UI 組件也有一個命令行對應物,我們可以使用它來執行所有可以用 UI 完成的操作。 我從一個簡單的組件開始。 它包含用 C# 開發的 asmx Web 服務,通常托管在 Windows 機器上的 IIS 上。 它將其文件安裝到以下位置

  1. C:\\program Files\\ ==> 可配置
    1. C:\\程序數據\\

我通過以下操作創建了 docker 文件

  1. 獲取 Windows Server 核心映像並啟用 iis 和其他依賴項
    1. 將安裝程序從主機復制到容器
    2. 使用 msiexec 命令以靜默模式運行安裝程序。

當我使用此 docker 文件運行 docker build 命令時,出現錯誤無法訪問網絡位置“C:\\Program Files\\\\

沒有谷歌的幫助。 任何人都可以幫助我解決這個問題。 我有幾個問題 1. 默認情況下,docker 容器是否包含默認的 Windows 目錄,如程序文件、程序文件 (x86)、用戶配置文件、程序數據和應用程序數據?

編輯:對延遲響應表示歉意。 提供下面的docker文件

FROM microsoft/aspnet
WORKDIR C:\\Installers
COPY EKBCS.exe C:\\Installers\\myinstaller.exe
COPY EKBCS.properties C:\\Installers\\myinstaller.properties
#RUN msiexec /unreg
#RUN msiexec /regserver
#RUN ["net start", "msiserver"]
RUN ["myinstaller.exe", "/l*v myinstaller.log",  "/qn PROPERTYFILE=myinstaller.properties"]
ENTRYPOINT ["powershell"]

以下是安裝程序日志中的錯誤。

-- 錯誤 1719。無法訪問 Windows 安裝程序服務。 如果您在安全模式下運行 Windows,或者未正確安裝 Windows 安裝程序,則可能會發生這種情況。 聯系您的支持人員尋求幫助。

我嘗試取消注冊並注冊 msi 安裝程序服務,但這沒有幫助。 因此評論了這些行。 非常感謝任何幫助。

我在2年前做過類似的工作,將我們組織中的一些C#代碼碼頭化了。
這是其中一個Dockerfile的片段,該片段應該可以幫助您實現想要做的事情-

FROM microsoft/windowsservercore

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

#Copy installers
RUN (New-Object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/B/4/A/B4A8422F-C564-4393-80DA-6865A8C4B32D/MicrosoftAzureAuthoringTools-x64.msi', 'c:\tools\MicrosoftAzureAuthoringTools-x64.msi') ;\
    (New-Object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/B/4/A/B4A8422F-C564-4393-80DA-6865A8C4B32D/MicrosoftAzureLibsForNet-x64.msi', 'c:\tools\MicrosoftAzureLibsForNet-x64.msi') ;\
    Start-Process 'msiexec' -ArgumentList '/i c:\tools\MicrosoftAzureAuthoringTools-x64.msi /quiet /qn /norestart /log c:\tools\installAuth.log'; \
    Start-Sleep -s 30 ;\
    Start-Process 'msiexec' -ArgumentList '/i c:\tools\MicrosoftAzureLibsForNet-x64.msi /quiet /qn /norestart /log c:\tools\installLib.log';\
    Start-Sleep -s 30 ;\
    Remove-Item c:\tools\*.msi -force

我的示例從Internet下載文件,然后從將文件下載到的c:\\tools文件夾中安裝文件,但是它應該也能正常工作,並且消除了對主機上現有文件的依賴。
希望能幫助到你。

建立五步動作... :-)

FROM mcr.microsoft.com/windows/servercore:ltsc2019
WORKDIR "C:\zenonSetup"
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN net use X: \\ATSZG-WKS210\zenonSetup <PwdPlain> /user:<Domain\User>;\
    Start-Process 'X:\SetupPrerequisites\Microsoft Visual C++ 2010 Redistributable\vstor_redist.exe' '/quiet /install' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\Microsoft Visual C++ 2013 Redistributable (x86)\vcredist_x86.exe' '/quiet /install' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\Microsoft Visual C++ 2013 Redistributable (x64)\vcredist_x64.exe' '/quiet /install' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\Microsoft Visual C++ 2017 Redistributable (x86)\vc_redist.x86.exe' '/quiet /install' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\Microsoft Visual C++ 2017 Redistributable (x64)\vc_redist.x64.exe' '/quiet /install' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\Microsoft Visual Studio 2017 Remote Tools\VS_RemoteTools.exe' '/quiet /install' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\CodeMeter Runtime Kit (x64)\CodeMeterRuntime64.exe' '/q' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\VBA\x86\Vba71.msi' '/qn' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\VBA\x86\Vba71_1033.msi' '/qn' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\VBA\x64\Vba71.msi' '/qn' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\VBA\x64\Vba71_1033.msi' '/qn' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\dotnet-runtime-2.1.5-win-x86.exe' '/quiet /install' -PassThru | Wait-Process;\
    Start-Process 'X:\SetupPrerequisites\dotnet-runtime-2.1.5-win-x64.exe' '/quiet /install' -PassThru | Wait-Process;\
    Start-Process 'X:\MSI\commonX86.msi' '/qn' -PassThru | Wait-Process;\
    Start-Process 'X:\MSI\commonX64.msi' '/qn' -PassThru | Wait-Process;\
    Start-Process 'X:\MSI\commonoemX86.msi' '/qn' -PassThru | Wait-Process;\
    Start-Process 'X:\MSI\scadaX86.msi' '/qn CDPROP_TYPE=RT CDPROP_EDITION=SUPERVISOR INSTALLDIR_X86=C:\zenonSetup\32 INSTALLDIR_X64=C:\zenonSetup\64 ADDLOCAL=ALL' -PassThru | Wait-Process;\
    Start-Process 'X:\MSI\scadaX64.msi' '/qn CDPROP_TYPE=RT CDPROP_EDITION=SUPERVISOR INSTALLDIR_X86=C:\zenonSetup\32 INSTALLDIR_X64=C:\zenonSetup\64 ADDLOCAL=ALL' -PassThru | Wait-Process;\
    Copy-Item -Path 'X:\settings.ps1' -Destination '.\settings.ps1';\
    Copy-Item -Path 'X:\templates.ps1' -Destination '.\templates.ps1';\
    Copy-Item -Path 'X:\start.bat' -Destination '.\start.bat';\
    Copy-Item -Path 'X:\zenonDataTemplates' -Destination '.\zenonDataTemplates' -Recurse;

ENTRYPOINT ["CMD", "/K", "C:\\zenonSetup\\start.bat"]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM