dotnet / dotnet-docker

Docker images for .NET and the .NET Tools.
https://hub.docker.com/_/microsoft-dotnet
MIT License
4.49k stars 1.94k forks source link

alpine images have no cultures installed #533

Closed cypressious closed 6 years ago

cypressious commented 6 years ago

Steps to reproduce the issue

  1. Create a new ASP.NET Core 2.1 project
  2. Somewhere in your code, print CultureInfo.GetCultures(CultureTypes.AllCultures)
  3. Run in Docker, using
    
    FROM microsoft/dotnet:2.1-aspnetcore-runtime-alpine AS base
    WORKDIR /app
    EXPOSE 80 5000

FROM microsoft/dotnet:2.1-sdk-alpine AS build WORKDIR /src COPY CultureTest/CultureTest.csproj CultureTest/ RUN dotnet restore CultureTest/CultureTest.csproj COPY . . WORKDIR /src/CultureTest RUN dotnet build CultureTest.csproj -c Release -o /app

FROM build AS publish RUN dotnet publish CultureTest.csproj -c Release -o /app

FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "CultureTest.dll"]


## Expected behavior

A list of installed cultures

## Actual behavior

An empty list

## Additional information (e.g. issue happens only occasionally)

## Output of `docker version`

Client: Version: 18.03.1-ce API version: 1.37 Go version: go1.9.5 Git commit: 9ee9f40 Built: Thu Apr 26 07:12:48 2018 OS/Arch: windows/amd64 Experimental: false Orchestrator: swarm

Server: Engine: Version: 18.03.1-ce API version: 1.37 (minimum version 1.12) Go version: go1.9.5 Git commit: 9ee9f40 Built: Thu Apr 26 07:22:38 2018 OS/Arch: linux/amd64 Experimental: true


## Output of `docker info`

Containers: 1 Running: 1 Paused: 0 Stopped: 0 Images: 37 Server Version: 18.03.1-ce Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88 runc version: 4fc53a81fb7c994640722ac585fa9ca548971871 init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 4.9.87-linuxkit-aufs Operating System: Docker for Windows OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 1.934GiB Name: linuxkit-00155db29d0f ID: 5HYC:PU25:4SOG:EHA5:THHC:IVLC:K2OK:DJUG:O356:MTIX:6WIJ:3EJS Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): true File Descriptors: 48 Goroutines: 86 System Time: 2018-05-09T08:39:38.5427872Z EventsListeners: 1 Registry: https://index.docker.io/v1/ Labels: Experimental: true Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false

cypressious commented 6 years ago

Possibly related to https://github.com/gliderlabs/docker-alpine/issues/144

MichaelSimons commented 6 years ago

As noted, this is a larger Alpine issue that is not specific to the microsoft/dotnet alpine images. There is nothing we would do to fix this in microsoft/dotnet.

cypressious commented 6 years ago

It seems, https://github.com/dotnet/dotnet-docker/blob/master/samples/dotnetapp/Dockerfile.alpine-x64-globalization contains a workaround.

MichaelSimons commented 6 years ago

@cypressious - see Build and run the sample for Alpine with Docker for the background on this.

toftware commented 6 years ago

When you try to get a specific culture you also get no exception, instead you just get the invariant culture.

petrformanek commented 2 years ago

Hello, to enable all cultures in Alpine you should do following:

# Install Culture prerequisities
RUN apk add --no-cache \
        icu-data-full \
        icu-libs

# enable all cultures - it is set to true in base image
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

I took it from SDK docker file.