title: Running .NET 6 project in Docker throws Globalization.CultureNotFoundException
body: <p>I have upgraded API project from .NET 5 to .NET 6 successfully and running fine when executed locally (without Docker).</p>
  <p>I have also updated the version in Dockerfile from &quot;5.0-alpine3.13&quot; to &quot;<strong>6.0-alpine3.14</strong>&quot; as below (only change I made).</p>
  <pre><code>ARG VERSION=6.0-alpine3.14
  
  #Runtime stage
  FROM mcr.microsoft.com/dotnet/aspnet:$VERSION AS base
  EXPOSE 8080
  ENV DOTNET_RUNNING_IN_CONTAINER=true \
    ASPNETCORE_URLS=http://+:8080
  
  #Build stage
  FROM mcr.microsoft.com/dotnet/sdk:$VERSION AS build
  WORKDIR /src
  COPY [&quot;/src/RM.Api/RM.Api.csproj&quot;, &quot;/src/RM.Api/&quot;]
  RUN dotnet restore &quot;/src/RM.Api/RM.Api.csproj&quot;
  COPY . .
  WORKDIR &quot;/src/src/RM.Api&quot;
  
  #Publish dotnet project
  FROM build AS publish
  ARG BUILDCONFIG=RELEASE
  RUN dotnet publish &quot;RM.Api.csproj&quot; -c $BUILDCONFIG -o /app/publish
  
  #Create local user, change ownership, and copy artifacts
  FROM base AS final
  WORKDIR /app
  RUN adduser \
    --disabled-password \
    --home /app \
    --gecos '' app \
    &amp;&amp; chown -R app /app
  USER app
  COPY --from=publish /app/publish .
  ENTRYPOINT [&quot;dotnet&quot;, &quot;RM.Api.dll&quot;]
  </code></pre>
  <p>But when I run this .NET 6 project in Docker it throws the below Azure.Storage exception in the Startup.cs file.</p>
  <p><a href="https://i.stack.imgur.com/MMPEn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MMPEn.jpg" alt="API-Startup.cs" /></a></p>
  <p>Full stack trace is here.</p>
  <pre><code>Microsoft.Azure.Storage.StorageException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
  en-US is an invalid culture identifier.
  ---&gt; System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
  en-US is an invalid culture identifier.
  at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
  at Microsoft.Azure.Storage.Core.Util.AuthenticationUtility.AppendCanonicalizedCustomHeaders(CanonicalizedString canonicalizedString, HttpRequestMessage request)
  at Microsoft.Azure.Storage.Core.Auth.SharedKeyCanonicalizer.CanonicalizeHttpRequest(HttpRequestMessage request, String accountName)
  at Microsoft.Azure.Storage.Auth.Protocol.StorageAuthenticationHttpHandler.GetSharedKeyAuthenticationTask(StorageRequestMessage request, CancellationToken cancellationToken)
  at Microsoft.Azure.Storage.Auth.Protocol.StorageAuthenticationHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  at System.Net.Http.HttpClient.&lt;&gt;n__0(HttpRequestMessage request, CancellationToken cancellationToken)
  at System.Net.Http.HttpClient.&lt;SendAsync&gt;g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
  at Microsoft.Azure.Storage.Core.Executor.Executor.ExecuteAsync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
  --- End of inner exception stack trace ---
  at Microsoft.Azure.Storage.Core.Executor.Executor.ExecuteAsync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
  at Microsoft.Azure.Storage.Blob.CloudBlobContainer.CreateAsync(BlobContainerPublicAccessType accessType, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
  at Microsoft.Azure.Storage.Blob.CloudBlobContainer.CreateIfNotExistsAsync(BlobContainerPublicAccessType accessType, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
  at RM.Api.Startup.ConfigureServices(IServiceCollection services) in /src/src/RM.Api/Startup.cs:line 91
  </code></pre>
  <p>I have updated the Dockerfile as below but it did not work.
  Can any one help here?</p>
  <pre><code>ARG VERSION=6.0-alpine3.14
  
  #Runtime stage
  FROM mcr.microsoft.com/dotnet/aspnet:$VERSION AS base
  EXPOSE 8080
  ENV DOTNET_RUNNING_IN_CONTAINER=true \
    ASPNETCORE_URLS=http://+:8080
  
  #Build stage
  FROM mcr.microsoft.com/dotnet/sdk:$VERSION AS build
  WORKDIR /src
  COPY [&quot;/src/RM.Api/RM.Api.csproj&quot;, &quot;/src/RM.Api/&quot;]
  RUN dotnet restore &quot;/src/RM.Api/RM.Api.csproj&quot;
  COPY . .
  WORKDIR &quot;/src/src/RM.Api&quot;
  
  RUN apk add --no-cache icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib
  
  ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
  
  #Publish dotnet project
  FROM build AS publish
  ARG BUILDCONFIG=RELEASE
  RUN dotnet publish &quot;RM.Api.csproj&quot; -c $BUILDCONFIG -o /app/publish
  
  #Create local user, change ownership, and copy artifacts
  FROM base AS final
  WORKDIR /app
  RUN adduser \
    --disabled-password \
    --home /app \
    --gecos '' app \
    &amp;&amp; chown -R app /app
  USER app
  COPY --from=publish /app/publish .
  ENTRYPOINT [&quot;dotnet&quot;, &quot;RM.Api.dll&quot;]
  </code></pre>
  <p>========UPDATE==========</p>
  <p>Making the following two changes resolved the issue.</p>
  <ol>
  <li><p>Updating the Dockerfile as below</p>
  <p>ARG VERSION=6.0-alpine3.14</p>
  <p>#Runtime stage
  FROM mcr.microsoft.com/dotnet/aspnet:$VERSION AS base
  EXPOSE 8080
  ENV DOTNET_RUNNING_IN_CONTAINER=true <br />
  ASPNETCORE_URLS=http://+:8080
  RUN apk add --no-cache icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib
  ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false</p>
  </li>
  <li><p>Added the below in .csproj file</p>
  </li>
  </ol>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;PropertyGroup&gt;
      &lt;InvariantGlobalization&gt;false&lt;/InvariantGlobalization&gt;
      &lt;/PropertyGroup&gt;</code></pre>
  </div>
  </div>
  </p>