gpt4 book ai didi

docker - 在Kubernetes上运行dotnet core 3.0 docker镜像时出错

转载 作者:行者123 更新时间:2023-12-02 11:43:12 29 4
gpt4 key购买 nike

重现此问题的步骤

  • 使用dotnet CLI(dotnet --version = 3.0.100)创建一个webapi项目模板
  • 构建dockerfile以创建镜像(请参见下面的dockerfile)
  • 在本地docker上运行docker镜像(工作正常)
  • 将此Docker镜像推送到Docker注册表
  • 将此部署到K8(在AWS上使用EKS)

  • 预期行为

    Pod启动,并运行webapi

    实际行为

    Pod无法启动,日志中出现以下错误:
    terminate called after throwing an instance of 'boost::wrapexcept<util::AprException>'
    what(): BaseException: Could not find the requested symbol. at /opt/jenkins/oa-s173/cmake-64-d/agent/native/shared/libutil/src/main/cpp/util/AprException.h:54 at static void util::AprException::check(apr_status_t)
    at liboneagentdotnet.so [0x90ec22]
    at liboneagentdotnet.so [0x90ed1b]
    at liboneagentdotnet.so [0x90ed7c]
    at liboneagentdotnet.so [0x143d61]
    at liboneagentdotnet.so [0x144adb]
    at unknown [0x7f4a024acee2]
    at unknown [0x7f4a024accef]
    at unknown [0x7f4a024a4e48]
    at unknown [0x7f4a024acb40]
    at unknown [0x7f4a024aca6c]
    at unknown [0x7f4a024ac77a]
    at unknown [0x7f4a024a3299]
    at unknown [0x7f4a024a2dd1]
    at unknown [0x7f4a024a2d4e]
    at unknown [0x7f4a024a2425]
    at unknown [0x7f4a020ac426]
    at unknown [0x7f4a020aca3d]
    at libcoreclr.so(CallDescrWorkerInternal+0x7b) [0x24dcae]
    at libcoreclr.so(CallDescrWorkerWithHandler(CallDescrData*, int)+0x74) [0x17dfc4]
    at libcoreclr.so(DispatchCallDebuggerWrapper(CallDescrData*, ContextTransitionFrame*, int)+0x86) [0x17e0b6]
    at libcoreclr.so(DispatchCallSimple(unsigned long*, unsigned int, unsigned long, unsigned int)+0xb6) [0x17e236]
    at libcoreclr.so(MethodTable::RunClassInitEx(Object**)+0x1a1) [0x115d61]
    at libcoreclr.so(MethodTable::DoRunClassInitThrowing()+0x2f8) [0x1162e8]
    at libcoreclr.so(JIT_GetSharedNonGCStaticBase_Helper+0xcf) [0x1b916f]
    at unknown [0x7f4a020ac2ea]
    at unknown [0x7f4a020ab4ec]
    at unknown [0x7f4a020aadad]
    at libcoreclr.so(CallDescrWorkerInternal+0x7b) [0x24dcae]
    at libcoreclr.so(CallDescrWorkerWithHandler(CallDescrData*, int)+0x74) [0x17dfc4]
    at libcoreclr.so(DispatchCallDebuggerWrapper(CallDescrData*, ContextTransitionFrame*, int)+0x86) [0x17e0b6]
    at libcoreclr.so(DispatchCallSimple(unsigned long*, unsigned int, unsigned long, unsigned int)+0xb6) [0x17e236]
    at libcoreclr.so(MethodTable::RunClassInitEx(Object**)+0x1a1) [0x115d61]
    at libcoreclr.so(MethodTable::DoRunClassInitThrowing()+0x2f8) [0x1162e8]
    at libcoreclr.so [0x29c00b]
    at libcoreclr.so [0x2551cc]
    at libcoreclr.so [0x2548c4]
    at libcoreclr.so [0x2546b3]
    at libcoreclr.so [0x29ba01]
    at libcoreclr.so(MethodTable::EnsureInstanceActive()+0x92) [0x115a92]
    at libcoreclr.so(MethodDesc::EnsureActive()+0x22) [0x109ae2]
    at libcoreclr.so [0x262507]
    at libcoreclr.so [0x26291f]
    at libcoreclr.so(CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*)+0x240) [0xcae90]
    at libcoreclr.so(coreclr_execute_assembly+0xd3) [0xa3c63]
    at libhostpolicy.so [0x161c2]
    at libhostpolicy.so(corehost_main+0xcb) [0x16a1b]
    at libhostfxr.so [0x2ab0f]
    at libhostfxr.so [0x296a2]
    at libhostfxr.so(hostfxr_main_startupinfo+0x92) [0x246f2]
    at dotnet [0xc440]
    at dotnet [0xc9fd]
    at libc.so.6(__libc_start_main+0xea) [0x2409a]
    at dotnet(_start+0x28) [0x2f3f]

    附加信息

    dockerfile如下:
    FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build-env
    WORKDIR /build

    COPY /src .
    RUN dotnet restore
    RUN dotnet build
    RUN dotnet publish -c Release -o ./out

    FROM mcr.microsoft.com/dotnet/core/aspnet:3.0
    WORKDIR /app
    COPY --from=build-env /build/out .
    ENTRYPOINT ["dotnet", "Weather.dll"]

    这是不寻常的,仅在K8上才发生,在将其作为向dotnetcore 3.0迁移的一部分进行测试

    当执行 runtime时指定 dotnet publish标志时,此行为不会改变。
    docker version的输出
    Local docker for windows version: Docker version 19.03.2, build 6a30dfc
    Container Runtime Version (on K8s): docker://18.6.1

    普通的留言

    不能完全确定问题出在哪里,只要对错误有所了解,我会感到满意。

    最佳答案

    这是由于Dynatrace不支持我们针对的dotnet core版本造成的。禁用此功能可以解决此问题。

    关于docker - 在Kubernetes上运行dotnet core 3.0 docker镜像时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58482732/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com