Closed TFTomSun closed 1 year ago
Duplicate of https://github.com/microsoft/dotnet-framework-docker/issues/843. This is by design. See https://github.com/microsoft/dotnet-framework-docker/issues/843#issuecomment-965658746. You are encouraged to explicitly set it in your Dockerfile to work around the issue.
Describe the Bug
The environment variable DOTNET_RUNNING_IN_CONTAINER is not set in the LTSC2019 windows docker image: https://github.com/microsoft/dotnet-framework-docker/blob/eb57409401f2539761d4f8f0ac451e821493f69e/src/runtime/4.8/windowsservercore-ltsc2019/Dockerfile
It is set in all linux images and also in the LTSC2022 windows docker images: https://github.com/microsoft/dotnet-framework-docker/blob/eb57409401f2539761d4f8f0ac451e821493f69e/src/runtime/4.8/windowsservercore-ltsc2022/Dockerfile
According to the dotnet documentation, that variable can be used (without any restrictions) to detect whether dotnet is running in a container:
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables#dotnet_running_in_container-and-dotnet_running_in_containers
So I'd consider it as a bug, if the variable is not set in the LTSC2019 images. That leads to unexpected code behaviors if code is executed within a LTSC2019 image.