Running an exe file in windows container using docker

10,029

Found out that the exe was running fine and file was created. The way I logged in to container was wrong Use docker exec -it containername powershell

docker run -it --entrypoint powershell imagename --> Runs new instance of image not existing

Share:
10,029
Thirtha
Author by

Thirtha

Updated on June 25, 2022

Comments

  • Thirtha
    Thirtha almost 2 years

    I want to run an exe file on window container using Docker. My exe accepts parameters. New file gets created in predefined directory

    ie:- Test.exe -f1=file1.txt -f2=file2.txt
    
    **Output** :
    Writing file file1.txt
    Successfully created file file1.txt 
    Writing file2 file2.txt
    Successfully created file file2.txt
    Enjoy!!
    

    My docker file looks like below

    FROM microsoft/aspnet:3.5-windowsservercore-10.0.14393.1715 
    SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
    Copy Test.exe ./TestFolder/
    WORKDIR /TestFolder
    ENTRYPOINT ["Test.exe"]
    CMD ["f1=file1.txt","f2=file2.txt"]
    

    I build the image and run the container

    docker build -t image1 .
    docker run -it image1
    

    Once the container runs I get the exact above output but when I login to container machine using scripts, I don't see any file created in the predefined path. Am I missing out anything ? Is this the correct way to run exe file on windows base image?

    Any advice is appreciated. Thanks