dotnet / dotnet/core

.NetCore SDK 3.1 Docker not support ENV LC_ALL and LANG (2.1 is support)

Open
#5,225 5 comments 0 reactions 0 assignees View on GitHub
area-docker
Dominant language
PowerShell
Stars
22k
Forks
4.9k
Avg merge
5d 5h
Merged PRs (30d)
29

Description

# Issue Title

Those environment variables can't use in docker.
```
# ENV LANG th_TH.UTF-8
# ENV LC_ALL th_TH.UTF-8

```
From base image **mcr.microsoft.com/dotnet/core/sdk:3.1** previous I use 2.1 it work fine.

# Step 1

https://github.com/uopeydel/testdb

use this project step test is run command

docker build --pull --rm -f "dockerfile" -t testdb:latest "."

docker run -d -p 1144:443/tcp -p 1188:80/tcp testdb:latest

and go to url

http://localhost:1188/api/Values/GetData

It will show you error message

```
An unhandled exception occurred while processing the request.
SqlException: Invalid column name '__data_0'.
Microsoft.Data.SqlClient.SqlCommand+<>c.b__164_0(Task result)
```

Then comment line below in "dockerfile"

```
# ENV LANG th_TH.UTF-8
# ENV LC_ALL th_TH.UTF-8
```
then try to build docker and run again it will be work fine.

** please change ConnectionStrings before test

# Step 2

I tried to create new docker file pushed today name "dockerfile.v2"

You can run it by command

`docker build --pull --rm -f "dockerfile.v2" -t testdb:latest "."`

If I have 2 line of this code

```
ENV LC_ALL th_TH.UTF-8
ENV LANG th_TH.UTF-8
```

And run this command

`
docker run -p 1144:443/tcp -p 1188:80/tcp testdb:latest
`

It will show this error message

```
watch : Polling file watcher is enabled
watch : Started
watch : System.ArgumentException: An item with the same key has already been added. Key: /app/FirstCodeDb/Controllers/
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Microsoft.DotNet.Watcher.Internal.FileWatcher.AddDirectoryWatcher(String directory)
at Microsoft.DotNet.Watcher.Internal.FileSetWatcher.GetChangedFileAsync(CancellationToken cancellationToken, Action startedWatching)
at Microsoft.DotNet.Watcher.DotNetWatcher.WatchAsync(ProcessSpec processSpec, IFileSetFactory fileSetFactory, CancellationToken cancellationToken)
at Microsoft.DotNet.Watcher.Program.MainInternalAsync(IReporter reporter, String project, ICollection`1 args, CancellationToken cancellationToken)
at Microsoft.DotNet.Watcher.Program.RunAsync(String[] args)
watch : An unexpected error occurred
```

If I remove this 2 line

```
ENV LC_ALL th_TH.UTF-8
ENV LANG th_TH.UTF-8
```

It will work fine.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.