我有一个.NET核心Web作为Pod托管在Kubernetes中。它也公开为服务。我已经创建了一个Dev证书,它生成了一个aspnetapp.pfx文件。
下面是我的Docker文件的一个片段:
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 443
ENV ASPNETCORE_URLS=https://+:443
ENV ASPNETCORE_HTTPS_PORT=443
ENV ASPNETCORE_Kestrel__Certificates__Default__Password={password}
ENV ASPNETCORE_Kestrel__Certificates__Default__Path=APIGateway/Certificates/aspnetapp.pfx当我在Kubernetes中运行该应用程序时,我在容器日志中收到一个错误,容器无法启动:
error:2006D002:BIO routines:BIO_new_file:system lib我知道它能够找到SSL证书,但是,它抛出了上面的错误。
请帮助!:)
发布于 2022-10-18 15:27:09
我只是遇到了同样的问题,即使以前一切都很好,但还是更新了一些东西(可能是.NET 6.0.402),从而导致了一个问题。
我注意到,我在Docker容器中导出的dev cert pfx的权限设置为:
-rw------- 1 root root 2383 Oct 18 14:40 cert.pfx在我的Dockerfile中,我导出dotnet证书并运行chmod为每个人添加读取权限:
RUN dotnet dev-certs https --clean && dotnet dev-certs https --export-path /app/publish/cert.pfx -p {password}
RUN chmod 644 /app/publish/cert.pfx这导致了与我的应用程序文件相同的权限:
-rw-r--r-- 1 root root 535 Oct 18 14:11 appsettings.Development.json
-rw-r--r-- 1 root root 331 Sep 27 18:13 appsettings.json
-rw-r--r-- 1 root root 2383 Oct 18 14:40 cert.pfx为我修正了错误。
https://stackoverflow.com/questions/67725801
复制相似问题