LCOW WS2019中的Linux容器启动问题:CreateProcess期间出错:Windows系统调用失败:未指定错误0x80004005 问题解决方案#1 解决方案2

问题描述

上下文:我尝试从docker文件创建Linux容器,如下所示:

构建环境:Windows Server 2019

根据https://sebastiangogola.com/lcow-linux-containers-on-windows/在WS2019上启用了LCOW

Dockerfile

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-focal
workdir /app

# copy build
copY ./bin/ ./bin
copY ./docker/start.sh ./bin

# This converts line endings from Windows-style to unix-style. If the bash script has windows style endings,it will not run
RUN sed -i 's/\r$//' ./bin/start.sh

# Setup app
EXPOSE 4900
ENTRYPOINT ["./bin/start.sh"]

我收到以下异常:

ERROR: for app-testwebapi-linux-x64  Cannot start service app-testwebapi-linux-x64: container 1a10c15c608f98f5aa6997431c9ea2d6dd58e77e03bfff5efcaf164635c47263 encountered an error during CreateProcess: failure in a Windows system call: Unspecified error (0x80004005)
[Event Detail: Failed to run runc create/exec call for container 1a10c15c608f98f5aa6997431c9ea2d6dd58e77e03bfff5efcaf164635c47263: exit status 1 Stack Trace:
github.com/Microsoft/opengcs/service/gcs/runtime/runc.(*container).startProcess
        /go/src/github.com/Microsoft/opengcs/service/gcs/runtime/runc/runc.go:578
github.com/Microsoft/opengcs/service/gcs/runtime/runc.(*runcRuntime).runcreateCommand
        /go/src/github.com/Microsoft/opengcs/service/gcs/runtime/runc/runc.go:469
github.com/Microsoft/opengcs/service/gcs/runtime/runc.(*runcRuntime).CreateContainer
        /go/src/github.com/Microsoft/opengcs/service/gcs/runtime/runc/runc.go:113
github.com/Microsoft/opengcs/service/gcs/core/gcs.(*gcscore).ExecProcess
        /go/src/github.com/Microsoft/opengcs/service/gcs/core/gcs/gcs.go:354
github.com/Microsoft/opengcs/service/gcs/bridge.(*Bridge).execProcess
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:585
github.com/Microsoft/opengcs/service/gcs/bridge.(*Bridge).(github.com/Microsoft/opengcs/service/gcs/bridge.execProcess)-fm
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:236
github.com/Microsoft/opengcs/service/gcs/bridge.HandlerFunc.ServeMsg
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:68
github.com/Microsoft/opengcs/service/gcs/bridge.(*Mux).ServeMsg
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:139
github.com/Microsoft/opengcs/service/gcs/bridge.(*Bridge).ListenAndServe.func2.1
        /go/src/github.com/Microsoft/opengcs/service/gcs/bridge/bridge.go:315
runtime.goexit
        /usr/lib/go/src/runtime/asm_amd64.s:2361 Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandArgs":["./bin/start.sh"],"WorkingDirectory":"/app","Environment":{"ASPNETCORE_URLS":"http://+:80","DOTNET_RUNNING_IN_CONTAINER":"true","HOSTNAME":"1a10c15c608f","PATH":"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},"CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0],"OCISpecification":{"ociVersion":"1.0.1-dev","process":{"user":{"uid":0,"gid":0},"args":["./bin/start.sh"],"env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","HOSTNAME=1a10c15c608f","ASPNETCORE_URLS=http://+:80","DOTNET_RUNNING_IN_CONTAINER=true"],"cwd":"/app","capabilities":{"bounding":[

为什么要例外?什么意思?

解决方法

问题

start.sh没有执行权限。

解决方案#1

授予对.sh文件的执行权限,如下所示,

RUN chmod +x ./bin/start.sh

解决方案2

替代

而不是

COPY ./bin/ ./bin
COPY ./docker/start.sh ./bin

使用start.sh的文件夹副本(当位于./bin时)

COPY ./bin/ ./bin

将帮助服务正确启动。

很奇怪,但是,从文件夹复制更改为文件复制是我开始看到此问题的时候。