title: Jenkins: pass (environment) variable to Docker while building the image
body: <p>We are using <a href="https://jenkins.io/" rel="nofollow">Jenkins</a> to <strong>build</strong> and deploy Docker containers.</p>
  
  <p>I am using a variable ($ENVIRONMENT) inside the <strong>Dockerfile</strong>. How can I set this variable from Jenkins? Something like <code>ENVIRONMENT=test|live</code>. The variable must be available <em>inside</em> the docker container afterwards.</p>
  
  <p>Or in other words:
  How can I achieve <a href="https://github.com/docker/docker/issues/6822#issuecomment-168170031" rel="nofollow">this</a> from within Jenkins?</p>