.Net 5-无法在buster(Debian)容器中启用全球化



我遇到了与中所述相同的问题https://github.com/dotnet/dotnet-docker/issues/1483但这一次使用的是mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim.

问题

如果执行了Console.WriteLine($"{251.97:c}"),则会出现奇怪的符号,而不是$或€。

复制步骤

这是我的Dockerfile(为了简单起见,去掉了dependencies副本(:

FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
# FastReports needs libdgiplus
RUN apt-get update && apt-get install -y libgdiplus
# Disable the invariant mode (set in base image)
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
ENV LC_ALL=es_ES.UTF-8 
LANG=es_ES.UTF-8        # I've tried also en_US
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /src
COPY ["MyProject.WebUI/MyProject.WebUI.csproj", "MyProject.WebUI/"]
RUN dotnet restore "MyProject.WebUI/MyProject.WebUI.csproj"
COPY . .
WORKDIR "/src/MyProject.WebUI"
RUN dotnet build "MyProject.WebUI.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "MyProject.WebUI.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MyProject.WebUI.dll"]

其他信息

输出:251,97

预计:251,97€

docker version的输出

Client: Docker Engine - Community
Cloud integration: 1.0.4
Version:           20.10.0
API version:       1.41
Go version:        go1.13.15
Git commit:        7287ab3
Built:             Tue Dec  8 18:55:31 2020
OS/Arch:           windows/amd64
Context:           default
Experimental:      true
Server: Docker Engine - Community
Engine:
Version:          20.10.0
API version:      1.41 (minimum version 1.12)
Go version:       go1.13.15
Git commit:       eeddea2
Built:            Tue Dec  8 18:58:04 2020
OS/Arch:          linux/amd64
Experimental:     false
containerd:
Version:          v1.4.3
GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version:          1.0.0-rc92
GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version:          0.19.0
GitCommit:        de40ad0

docker info的输出

Client:
Context:    default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.4.2-docker)
scan: Docker Scan (Docker Inc., v0.5.0)
Server:
Containers: 19
Running: 1
Paused: 0
Stopped: 18
Images: 186
Server Version: 20.10.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 4.19.128-microsoft-standard
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 6.068GiB
Name: docker-desktop
ID: G6ZX:FURA:YMMU:OQK7:FFVP:F6UD:SEQR:KJNC:CTHW:TVJY:KNJ6:Z5P7
Docker Root Dir: /var/lib/docker
Debug Mode: true
File Descriptors: 56
Goroutines: 62
System Time: 2020-12-29T05:43:26.9357651Z
EventsListeners: 4
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
WARNING: No blkio weight support
WARNING: No blkio weight_device support
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

我试图通过设置LC_ALLLANG变量来解决这个问题,但似乎不起作用。

感谢

好吧,好像是我的错。

我已经删除了图像和容器,它按预期工作。

最新更新