Running .exe files within a docker environment - windows server core

80 views Asked by At

I have a Docker container running Windows Server Core 2019. In that container, I have an app (for training users)that spins up a local web server to run the application (the application opens up a new browser tab, then the user goes through the training.)

Goal I'm trying to run the exe in the docker container and then that would expose a port that the training application is being run on.

Things to note:

  • I installed this app from a disc and then transferred the files to the project so I don't have the original source files.
  • The app works on my computer outside of a docker container
  • I noticed that the exe automatically opens up in the browser in order to work and it's on 8080.
  • I made the docker file install Chrome in order to open the exe.
  • I run the image and then I access the command line with the container to try and run the application but nothing happens. I even tried setting Chrome as the default browser.
  • My docker desktop is set to use windows containers

What I think the problem is:

  • The base image still doesn't allow to open the app because it doesn't allow GUI
  • Maybe I have to make a custom base image but I also want it to be lightweight
  • Maybe I didn't configure the docker file correctly?

I'm new to Docker so I may have missed something. Any advice helps :)

# 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
0

There are 0 answers