0
Container Environment Variables
You set an environment variable in your Dockerfile, but the app reads it as null inside the running container. Most of the time, the variable was never actually exported to the process environment.
Passing variables at runtime
Use the ENV instruction in your Dockerfile for build-time defaults, but inject secrets and overrides with docker run -e or a compose file. The .NET process only sees what the OS exposes.
- Double-check spelling; environment variables are case-sensitive on Linux hosts.
- Restart the container after changing the compose file to apply new values.
- Avoid hardcoding paths that assume a specific host OS layout.