不支持文化 1033 (0x0409)

Culture is not supported 1033 (0x0409)

我正在使用 dotnet 2.2 映像 运行 我在环境中的服务应用程序:docker windows(linux 容器)

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine AS build-env

并遇到以下错误:

System.Globalization.CultureNotFoundException: 不支持文化。|参数名称:文化| 1033 (0x0409) 是无效的区域性标识符。

我在 docker 文件中设置了以下内容。构建没有问题,但在应用程序 运行ning

时仍然显示错误

# Set the locale
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8 

这有效。

更新解决方案: 我在 teamcity 有 运行 相同的 docker 图片,基于 linux 的环境,根本不需要定义代码页的额外行。

所以这个问题只发生在 docker windows(linux 容器)运行 Windows 10.

# Disable the invariant mode (set in base image)
RUN apk add --no-cache icu-libs

ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
    LC_ALL=en_US.UTF-8 \
    LANG=en_US.UTF-8