Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
356 views
in Technique[技术] by (71.8m points)

Third party Exe file can not be executed inside Docker Windows Container

I'm trying to execute a win exe file that is not from my property BrowserStackLocal.exe https://www.browserstack.com/local-testing/automate#establishing-a-local-testing-connection

This is my Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:5.0

SHELL ["pwsh", "-Command"]

ENV BINARIES=/binaries

WORKDIR $BINARIES

RUN Invoke-WebRequest -Uri https://www.browserstack.com/browserstack-local/BrowserStackLocal-win32.zip -OutFile $env:BINARIES/BrowserStackLocal-win32.zip && 
Expand-Archive -LiteralPath $env:BINARIES/BrowserStackLocal-win32.zip -DestinationPath $env:BINARIES && 
Remove-Item $env:BINARIES/BrowserStackLocal-win32.zip

RUN ls
RUN ps
RUN ./BrowserStackLocal.exe
RUN ps

This is the output

Building qa-aut-net5
Step 1/9 : FROM mcr.microsoft.com/dotnet/sdk:5.0
 ---> de8b4af9de0d
Step 2/9 : SHELL ["pwsh", "-Command"]
 ---> Using cache
 ---> 8977a4b019ef
Step 3/9 : ENV BINARIES=/binaries
 ---> Using cache
 ---> 66200b6b9a18
Step 4/9 : WORKDIR $BINARIES     
 ---> Using cache
 ---> 6e530b267fe4
Step 5/9 : RUN Invoke-WebRequest -Uri https://www.browserstack.com/browserstack-local/BrowserStackLocal-win32.zip -OutFile $env:BINARIES/BrowserStackLocal-win32.zip && Expand-Archive -LiteralPath $env:BINARIES/BrowserStackLocal-win32.zip -DestinationPath $env:BINARIES && Remove-Item $env:BINARIES/BrowserStackLocal-win32.zip
 ---> Running in 0e672adafa5b
Removing intermediate container 0e672adafa5b
 ---> 680bd1b4c2db
Step 6/9 : RUN ls
 ---> Running in 6e51157b7245

    Directory: C:inaries

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a    ---          12/18/2020  9:11 AM       41220096 BrowserStackLocal.exe

Removing intermediate container 6e51157b7245
 ---> cb7b0be51d38
Step 7/9 : RUN ps
 ---> Running in ce4e5d7f7ae0

 NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
 ------    -----      -----     ------      --  -- -----------
      6     1.00       3.77       0.00    1076   1 CExecSvc
      6     1.04       2.24       0.00     976   1 csrss
      0     0.06       0.01       0.00       0   0 Idle
     17     2.72       9.37       0.00     328   1 lsass
     49    47.79      69.54       1.31    1324   1 pwsh
      9     1.63       5.04       0.00      64   1 services
      4     0.49       1.16       0.00     952   0 smss
     12     2.91       9.99       0.00     484   1 svchost
     14     1.98       6.63       0.00     636   1 svchost
      8     1.84       6.04       0.00     796   1 svchost
      7     1.40       4.65       0.00    1052   1 svchost
     15     5.48      10.54       0.00    1116   1 svchost
     14     2.71       7.68       0.00    1204   1 svchost
     15     9.45      19.04       0.00    1360   1 svchost
      0     0.15       0.14       0.00       4   0 System
      8     1.25       4.13       0.00    1012   1 wininit

Removing intermediate container ce4e5d7f7ae0
 ---> 1b7f55f0de14
Step 8/9 : RUN ./BrowserStackLocal.exe
 ---> Running in fd16d66e6dba
ERROR: Service 'qa-aut-net5' failed to build : The command 'pwsh -Command ./BrowserStackLocal.exe' returned a non-zero code: 1

Returns this and there are no details about the error:

ERROR: Service 'XXX' failed to build : The command 'pwsh -Command ./BrowserStackLocal.exe' returned a non-zero code: 1

You can check the BrowserStackLocal.exe was downloaded successfully in the log, also I tried executing the same file in machines in Windows and it's working fine. The problem only happened when I run inside the docker windows container.

Maybe some DLL files are missing or I need to install anything else. Do you have any idea to resolve this? or any workaround?

Thank you in advance.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...