title: Use an argument from docker-compose build --build-arg inside a Dockerfile
body: <p>I want to be able to build an image while replacing the <code>HOSTNAME</code> in my files automatically at build with the use of <code>sed</code>:</p>
  
  <p>This my Dockerfile:</p>
  
  <pre><code>FROM ...            
  RUN sed -i -- 's/0.0.0.0/$HOSTNAME/g' index.html
  </code></pre>
  
  <p>This is my command:</p>
  
  <pre><code>docker-compose build --build-arg HOSTNAME='justanotherhostname.com'
  </code></pre>
  
  <p>When I check the resulting <code>index.html</code>, my paths went from this:</p>
  
  <pre><code>path = 'http://0.0.0.0/'
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>path = 'http://$HOSTNAME/'
  </code></pre>
  
  <p>and not this:</p>
  
  <pre><code>path = 'http://justanotherhostname.com/'
  </code></pre>
  
  <p>What am I doing wrong?</p>