使用docker在windows容器中运行exe文件。

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

我想使用Docker在window容器上运行一个exe文件。我的exe文件接受参数。新文件被创建在预定义的目录下

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!!

我的docker文件如下

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"]

我构建图像并运行容器

docker build -t image1 .
docker run -it image1

容器运行后,我得到了上述确切的输出,但当我使用脚本登录到容器机器时,我没有看到在预定义路径中创建任何文件。这是在windows基础镜像上运行exe文件的正确方法吗?

任何建议都是感激的。谢谢你

docker-compose dockerfile docker-machine docker-for-windows docker-container
1个回答
0
投票

发现exe运行正常,文件被创建,我登录容器的方式是错误的 使用 docker exec -it containername powershell

docker run -it --entrypoint powershell imagename --> 运行不存在的新图像实例。

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