【问题标题】:"The system cannot find the file specified." when running ECS Fargate task“该系统找不到指定的文件。”运行 ECS Fargate 任务时
【发布时间】:2022-01-15 06:00:05
【问题描述】:

我正在尝试在 AWS ECS 上运行 Fargate (Windows) 任务,但一旦结束它的“PENDING”状态就会失败。我不确定我错过了什么。只有 1 个可能的文件可能导致此问题 - 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].

【问题讨论】:

  • 嗨,也许考虑使用Qovery 对你来说是最好的选择?
  • @eVoxmusic 感谢您的留言。但是,向我们的团队添加另一个(付费)工具只是为了部署该项目是不可加速的。我们在全公司范围内使用 Terraform

标签: .net docker dockerfile amazon-ecs aws-fargate


【解决方案1】:

在深入挖掘之后,我发现我错过了指定容器的ENTRYPOINT,在我的例子中是powershell。波纹管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/ .

# For debugging purposes only
#RUN Enable-WindowsOptionalFeature -Online -FeatureName "TelnetClient"

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.
ENTRYPOINT ["powershell.exe"]
CMD ["C:/service/Wait-Service.ps1", "-ServiceName", "SprProductionDataService", "-StartupTimeout", "10", "-AllowServiceRestart"];

【讨论】:

    猜你喜欢
    • 2013-12-26
    • 1970-01-01
    • 2019-09-25
    • 1970-01-01
    • 2018-10-27
    • 1970-01-01
    • 2022-11-03
    • 1970-01-01
    • 2019-09-10
    相关资源
    最近更新 更多