Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image terminates on start with "Couldn't find a valid ICU package installed on the system" #2229

Open
mikeminutillo opened this issue Jan 29, 2025 · 0 comments
Labels
Type: Bug Type: Bug

Comments

@mikeminutillo
Copy link
Member

Describe the bug

Description

Depending on the locale that the docker container is started in, it may fail at startup when trying to determine the application name.

Expected behavior

The container should start regardless of locale.

Actual behavior

The container halts at startup with an exception similar to this:

Process terminated. Couldn't find a valid ICU package installed on the system. Please install libicu (or icu-libs) using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information.

Versions

Please list the version of the relevant packages or applications in which the bug exists.

Reported on versions 1.40.0 and above. 1.39.0 reported as working.

Steps to reproduce

  1. Create a docker container from version 1.40.0 image of ServicePulse on a machine with a locale that is not supported by the chiseled image that this is based on.
  2. Run the instance.
  3. Note the error

Relevant log output

Process terminated. Couldn't find a valid ICU package installed on the system. Please install libicu (or icu-libs) using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information.
at System.Environment.FailFast(System.String)
at System.Globalization.GlobalizationMode+Settings..cctor()
at System.Globalization.GlobalizationMode+Settings.get_Invariant()
at System.Globalization.GlobalizationMode.get_Invariant()
at System.Globalization.CultureData.CreateCultureWithInvariantData()
at System.Globalization.CultureData.get_Invariant()
at System.Globalization.CultureInfo..cctor()
at System.Globalization.CultureInfo.get_CachedCulturesByName()
at System.Globalization.CultureInfo.GetCultureInfo(System.String)
at System.Reflection.RuntimeAssembly.GetLocale()
at System.Reflection.RuntimeAssembly.GetName(Boolean)
at System.Reflection.Assembly.GetName()
at Microsoft.Extensions.Hosting.HostBuilder.CreateHostingEnvironment(Microsoft.Extensions.Configuration.IConfiguration)
at Microsoft.Extensions.Hosting.HostApplicationBuilder.Initialize(Microsoft.Extensions.Hosting.HostApplicationBuilderSettings, Microsoft.Extensions.Hosting.HostBuilderContext ByRef, Microsoft.Extensions.Hosting.IHostEnvironment ByRef, LoggingBuilder ByRef, MetricsBuilder ByRef)
at Microsoft.Extensions.Hosting.HostApplicationBuilder..ctor(Microsoft.Extensions.Hosting.HostApplicationBuilderSettings)
at Microsoft.AspNetCore.Builder.WebApplicationBuilder..ctor(Microsoft.AspNetCore.Builder.WebApplicationOptions, System.Action`1<Microsoft.Extensions.Hosting.IHostBuilder>)
at Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder(System.String[])
at Program.<Main>$(System.String[])

Additional Information

Workarounds

Set an environment variable on the container to turn off globalization:

  • Key: DOTNET_SYSTEM_GLOBALIZATION_INVARIANT
  • Value: 1

Possible solutions

Set the application name directly:

var webOptions = new WebApplicationOptions
{
    ApplicationName = "ServicePulse",
    Args = args
};
var builder = WebApplication.CreateBuilder(webOptions);

Or set the environment variable to run with an invariant culture and locale on the base image. The image hosts static files and should not need any culture-specific information.

Additional information

Docker containers are created with an invariant culture and locale when running in HyperV. They inherit the culture and locale of the host when running in Process Isolation Mode.

@mikeminutillo mikeminutillo added the Type: Bug Type: Bug label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Type: Bug
Projects
None yet
Development

No branches or pull requests

1 participant