title: Passing environment variables not working with Docker
body: <p>I am learning how to pass environment variables to Docker containers. While the following works fine,</p>
  
  <hr>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM ubuntu
  ENV USERNAME='david'
  CMD echo "username = $USERNAME"
  </code></pre>
  
  <p><strong>Build &amp; run commands</strong></p>
  
  <pre><code>docker build . -t enviro
  docker run -d enviro
  </code></pre>
  
  <p><strong>docker ps -a</strong> gives </p>
  
  <pre><code>2a3a69aa7868        enviro              "/bin/sh -c 'echo \"u…"
  </code></pre>
  
  <p><strong>docker logs 2a3a69aa7868</strong> gives </p>
  
  <pre><code>username = david
  </code></pre>
  
  <hr>
  
  <p>The following doesn't work</p>
  
  <hr>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM ubuntu
  CMD echo "username = $USERNAME"
  </code></pre>
  
  <p><strong>Build &amp; run commands</strong></p>
  
  <pre><code>docker build . -t enviro
  docker run -d enviro -e USERNAME='david'
  </code></pre>
  
  <p>Here the run command gives this,</p>
  
  <pre><code>docker: Error response from daemon: OCI runtime create failed: 
    container_linux.go:348: starting container process caused "exec: \"-e\": 
    executable file not found in $PATH": unknown.
  </code></pre>
  
  <p>While <strong>docker ps -a</strong> gives </p>
  
  <pre><code>249cb045c26a        enviro              "-e USERNAME=david"
  </code></pre>
  
  <p><strong>docker logs 249cb045c26a</strong> gives nothing </p>
  
  <hr>
  
  <p>Any idea, what is going on here? Why is the environment variable not being passed?</p>