title: Pass a variable to a Dockerfile from a docker-compose.yml file
body: <p>I have several docker-compose.yml files that I want to use the same Dockerfile with, with a slight variation. So I want to pass an argument to that Dockerfile so that I can do something slightly different depending on whatever value the variable is set to.</p>
  
  <p><strong>What I have tried so far</strong></p>
  
  <p>docker-compose-A.yml file</p>
  
  <pre><code>version: '2'
  
  services:
    django:
      build:
        context: .
        dockerfile: ./docker/Dockerfile
        args:
          - SOMETHING=foo
  </code></pre>
  
  <p>docker-compose-B.yml file</p>
  
  <pre><code>version: '2'
  
  services:
    django:
      build:
        context: .
        dockerfile: ./docker/Dockerfile
        args:
          - SOMETHING=bar
  </code></pre>
  
  <p>I have a dockerfile I want to use SOMETHING in. e.g.</p>
  
  <pre><code># Dockerfile
  RUN echo $SOMETHING
  </code></pre>
  
  <p>That doesn't work. SOMETHING is not passed to the dockerfile.</p>
  
  <p>Am I doing this incorrectly or is this not the intended usage?</p>
  
  <p>Is there any other way to pass a variable to a Dockerfile from a docker-compose.yml file?</p>