dotnet / dotnet-docker

Docker images for .NET and the .NET Tools.
https://hub.docker.com/_/microsoft-dotnet
MIT License
4.5k stars 1.94k forks source link

Document why `DOTNET_RUNNING_IN_CONTAINER` is needed #3997

Open richlander opened 2 years ago

richlander commented 2 years ago

This ENV is set in various runtime-deps and runtime images, and in various samples. It would be good to document why it is needed and which parts of the codebase honor that feature. That would help folks creating fully custom container deployments (not using our assets) to understand why setting this ENV does or does not matter.

https://github.com/dotnet/dotnet-docker/blob/7cf01d82858fcc3824574fb92580c4151954699a/src/runtime-deps/6.0/jammy/amd64/Dockerfile#L21

ericbl commented 2 years ago

It would be interesting if we can deploy a .net application within a docker container without this flag and without the runtime image! Now that the runtime can be installed on Ubuntu with simple 'apt install dotnet6', could a dotnet app in a docker container re use the runtime on the OS instead of within the container? It could bring some advantages to reduce image sizes on fully controlled OS output with multiple container deployment, e.g. on IOT market.