I have a .NET Core Console App. This console app loads a connection string stored in an environment variable. I'm retrieving that connection string using this code:
var connectionString = Environment.GetEnvironmentVariable("connection_string");
The line above works if I run the Console App by just pushing "play" in Visual Studio. However, if I run this Console App in a Docker container, the connectionString is empty. I assume it's because the connection_string environment variable is not in the Docker environment. However, I can't figure out how to add/set an environment variable in a Docker container.
For my last attempt, I added the following in my Dockerfile:
ENV connection_string <my_connection_string_value>
However, that didn't seem to matter. What am I missing?