我尝试在AWS ECS上运行Fargate(Windows)任务,但它在结束“挂起”状态后立即失败。我不确定我遗漏了什么。只有一个可能的文件可能导致此问题-Wait-Service.ps1
,但我不明白为什么它不应该被找到。Wait-Service.ps1
文件位于bin/Debug
文件夹中。
这是我的Dockerfile
:
# escape=\
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN "mkdir C:\temp"
WORKDIR "C:/service"
COPY bin/Debug/ .
RUN "C:/Windows/Microsoft.NET/Framework64/v4.0.30319/installutil.exe" /LogToConsole=true /ShowCallStack ./SprProductionDataService.exe; \
Set-Service -Name "\"SprProductionDataService\"" -StartupType Automatic;
# The container stays up as long as this process is running.
CMD "C:/service/Wait-Service.ps1" -ServiceName "SprProductionDataService" -StartupTimeout 10 -AllowServiceRestart;
我只看到此错误消息(在AWS控制台中):
Status reason CannotStartContainerError: CannotStartContainerError:
hcs::System::CreateProcess 5d85964e54844ae0ad18140057019deb-4109322994:
The system cannot find the file specified.: unknown
更新:
我试着运行从ECR回购中提取容器的操作,但也失败了:
PS D:\_Code\SPRProductionDataService\SprProductionDataService> docker run --name sprprod -it spr-production-service-dev-ecr:latest 208555724522.dkr.ecr.us-west-2.amazonaws.com/spr-production-service-dev-ecr:latest powershell
docker: Error response from daemon: container e1658203aca736881659e1a5445e8d0ec549ccf94fe2f2952012752e330d9826 encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF7FACA9F4B: (caller: 00007FF7FAC5E13A) Exception(2) tid(3a4) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000].
2条答案
按热度按时间yr9zkbsy1#
此处的问题在于ENTRYPOINT/CMD的指定方式。
在第一个停靠文件中,您以
shell
指定了CMD在第二个停靠文件中,您以exec
指定了ENTRYPOINT和CMD refer -这基本上,ECS Fargate运行containerd运行时,而此运行时在处理shell表单时效果不佳。
有一个公开的github问题描述了该行为。
2vuwiymt2#
在进一步挖掘之后,我发现我没有指定容器的
ENTRYPOINT
,在我的例子中是powershell
。下面的dockerfile
对我很有效: