title: Using an Environment Variable in a .NET Core Console App Hosted in Docker
body: <p>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:</p>
  
  <pre><code>var connectionString = Environment.GetEnvironmentVariable("connection_string");
  </code></pre>
  
  <p>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 <code>connectionString</code> is empty. I assume it's because the <code>connection_string</code> 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.</p>
  
  <p>For my last attempt, I added the following in my Dockerfile:</p>
  
  <pre><code>ENV connection_string &lt;my_connection_string_value&gt;
  </code></pre>
  
  <p>However, that didn't seem to matter. What am I missing?</p>