How to start PowerShell (x86) in Windows Docker Container?

妖精的绣舞 提交于 2020-03-01 04:42:28

问题


I am trying to start the PowerShell (x86) in Windows Docker Container from PowerShell but it won't start a new shell. I am running Docker from an AWS Windows EC2 running off the Windows_Server-2019-English-Full-ContainersLatest-2020.02.12 AMI. Do I need any specific DLLs to make this work?

I have Dockerfile which kind of looks like this:

FROM mcr.microsoft.com/windows/insider:10.0.17763.107
...
SHELL ["PowerShell", "-Command"]
...
CMD PowerShell

After the container start's up I try to start the 32-bit PowerShell using the below command but it doesn't start a new shell. I think it just errors out.

C:/Windows/SysWOW64/WindowsPowerShell/v1.0/powershell.exe

I tried to catch the ExitCode using the following commands:

$Process = Start-Process -PassThru -Wait -FilePath "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"
Write-Output "ExitCode = $($Process.ExitCode)"

Which outputs:

ExitCode = -1073741502

Which probably means STATUS_DLL_INIT_FAILED (What does ExitCode -1073741502 mean?)

The commands I am trying to execute in the Docker container work when I run it from the PowerShell in the EC2 host. I can verify by running [Environment]::Is64BitProcess which returns False.

—————————

This is the docker version I am running on the AWS EC2 based off of Windows_Server-2019-English-Full-Base-2020.02.12 (ami-00cb4c0d60b9476f4)

PS> docker version

Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:22:37 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.24)
  Go version:       go1.12.12
  Git commit:       633a0ea
  Built:            Wed Nov 13 07:36:50 2019
  OS/Arch:          windows/amd64
  Experimental:     false

Another Update:

The commands actually work when I run from a different EC2 that I had created a while back based off of ami-0d4df21ffeb914d61 (Which is also Windows_Server-2019-English-Full-Base but the ami is not public anymore)

Another Update:

Looks like it was an issue with the ami. Was able to make it work with a previous version, Windows_Server-2019-English-Full-Base-2020.01.15 (ami-09f2114fecbe506e2)

来源:https://stackoverflow.com/questions/60271051/how-to-start-powershell-x86-in-windows-docker-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!