在 docker 容器上运行多个先决条件 exe

问题描述 投票:0回答:1

我想在 docker 容器上构建一个复杂的遗留 .net 框架项目。在构建解决方案之前,需要安装相当多的先决条件可执行文件。我已经使用 windows servercore 2019 基础镜像创建了一个 dockerfile,如下所示

FROM mcr.microsoft.com/windows/servercore:ltsc2019
WORKDIR /App
COPY . ./
RUN powershell Start-Process vld-2.5.8-setup.exe
RUN powershell Start-Process jdk-7u25-windows-i586.exe
RUN powershell Start-Process jdk-7u25-windows-x64.exe 
#need to install few more build tools

当我构建图像时使用

docker build -t consoleapp_image . 
Step 1/6 : FROM mcr.microsoft.com/windows/servercore:ltsc2019
 ---> 997b460651ea
Step 2/6 : WORKDIR /App
 ---> Using cache
 ---> 1cd3b9f95bc9
Step 3/6 : COPY . ./
 ---> 871ad7a1c8f2
Step 4/6 : RUN powershell Start-Process vld-2.5.8-setup.exe
 ---> Running in eb11a9479c64
Removing intermediate container eb11a9479c64
 ---> 8330a331897d
Step 5/6 : RUN powershell Start-Process jdk-7u25-windows-i586.exe
 ---> Running in d95c69f4296f
Removing intermediate container d95c69f4296f
 ---> f3a1f0fe8819
Step 6/6 : RUN powershell Start-Process jdk-7u25-windows-x64.exe
 ---> Running in 46437b28ab84
Removing intermediate container 46437b28ab84
 ---> ba2d168b87b2
Successfully built ba2d168b87b2
Successfully tagged consoleapp_image:latest

我可以看到输出是成功构建的图像,但我不确定它们是否真的被安装了,因为当我尝试使用以下任何命令运行图像时我无法找到任何已安装的文件夹

docker exec -it container powershell
docker run -it consoleapp_image
  1. RUN powershell Start-Process 是安装任何先决条件的正确命令吗?
  2. 我在
    C:/Program Files
    C:/Program Files(x86)
    中看不到任何已安装的文件夹,我如何确保 exe 安装正确?

也试过静默安装,但是找不到已安装的文件夹

RUN powershell Start-Process jdk-7u25-windows-i586.exe -ArgumentList '/s'

感谢您的帮助

windows docker containers exe .net-4.8
1个回答
0
投票

通过命令运行jdks我已经成功获得了部分成功

RUN powershell Start-Process jdk-7u25-windows-i586.exe -ArgumentList '/s' -Wait
RUN powershell Start-Process jdk-7u25-windows-x64.exe -ArgumentList '/s' -Wait

但是,第三个 exe vldsetup.exe 没有以相同的方式工作,因为它需要一种接受许可协议的方式来完成安装。没有任何适用于所有前任的通用方法。我试过 '/accepteula' 但仍然抛出弹出式许可协议。感谢任何将许可协议设置为“我接受协议”并默默继续的想法。看起来默认设置为“我不接受协议”

© www.soinside.com 2019 - 2024. All rights reserved.