提问人:CleverlyDone 提问时间:11/8/2023 最后编辑:CleverlyDone 更新时间:11/9/2023 访问量:28
在 Docker 环境中运行 .exe 文件 - Windows 服务器核心
Running .exe files within a docker environment - windows server core
问:
我有一个运行 Windows Server Core 2019 的 Docker 容器。在该容器中,我有一个应用程序(用于培训用户),它启动本地 Web 服务器以运行应用程序(应用程序打开一个新的浏览器选项卡,然后用户完成培训。
目标我正在尝试在 docker 容器中运行 exe,然后这将暴露运行训练应用程序的端口。
注意事项:
- 我从光盘上安装了这个应用程序,然后将文件传输到 项目,所以我没有原始源文件。
- 该应用程序在 docker 容器之外的计算机上运行
- 我注意到exe按顺序在浏览器中自动打开 工作,它在 8080 上。
- 我让 docker 文件安装了 Chrome 以打开 exe。
- 我运行映像,然后使用容器访问命令行以尝试运行应用程序,但没有任何反应。我什至尝试将Chrome设置为默认浏览器。
- 我的 docker 桌面设置为使用 Windows 容器
我认为问题是:
- 基础映像仍然不允许打开应用程序,因为它不允许 GUI
- 也许我必须制作一个自定义基础映像,但我也希望它是轻量级的
- 也许我没有正确配置 docker 文件?
我是 Docker 的新手,所以我可能错过了一些东西。任何建议都有助于:)
# base image
FROM mcr.microsoft.com/windows/servercore:ltsc2019
# Set the SHELL to PowerShell for convenience
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
# Copy the Google Chrome offline installer into the container
COPY ["googlechromestandaloneenterprise64.msi", "./install/chrome_installer.msi"]
# Install Google Chrome silently
RUN Start-Process 'msiexec.exe' -ArgumentList '/i', 'C:\install\chrome_installer.msi', '/quiet', '/norestart' -NoNewWindow -Wait
# Set the working directory in the container
WORKDIR c:\\app
# Copy the entire app directory into the container
COPY ["local app folder in repo", "./new app folder in docker"]
# I wanted to run on container start but nothing happens
CMD ["c:\\app\\appfolder\\app name WebServer.exe"]
# Expose the port the app runs on
EXPOSE 8080
答: 暂无答案
评论