Skip to content

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

@mikeminutillo

Description

@mikeminutillo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions