title: SED not working on files copied using the COPY command in a Dockerfile
body: <p>I'm new to Docker so please be kind.</p>
  
  <p>I have a <code>Dockerfile</code> I'm working on that uses the <code>COPY</code> instruction to copy some files into an image I'm building. The <code>COPY</code> is working fine, the files end up in my Docker image at the end. The problem I have is when using the <code>RUN</code> command to execute a <code>sed</code> find and replace statement on some of the files I just copied to the image does not appear to make the changes in the final <code>docker</code> image.</p>
  
  <p>This is the build command I'm using.</p>
  
  <pre><code>docker build --build-arg web_domain=mydomain.com -t me/myproject:latest .
  </code></pre>
  
  <p>Here is a sample of the Dockerfile.</p>
  
  <pre><code>FROM mattrayner/lamp:latest-1804
  
  # Custom Arguments
  ARG web_domain
  
  # Copy Files Into Image
  COPY /app/src/ /app/src/
  
  
  # Add Domain to config
  RUN sed -i "s|\$domain = '';|\$domain = '${web_domain}';|g" /app/src/config.ini
  
  # Entrypoint
  CMD ["/run.sh"]
  </code></pre>
  
  <p>I'm expecting that this file <code>/app/src/config.ini</code> will contain a line in it that looks like:</p>
  
  <pre><code>$domain = 'mydomain.com';
  </code></pre>
  
  <p>What I'm finding is the file in the resulting docker container when it is run looks like this.</p>
  
  <pre><code>$domain = '';
  </code></pre>
  
  <p>I'm suspecting that because the copied file is not part of the base image that my changes with the <code>sed</code> command are only applied to the container produced with the <code>RUN</code> instruction. If that's the case how do I get the edited file into the <code>docker</code> image I'm trying to build?</p>