title: Reading input files with docker
body: <p>I'm writting a C++ program that is run as follows:</p>
  
  <pre><code>./program data_file config_file
  </code></pre>
  
  <p>And I want to use docker with it. I've written the following <code>Dockerfile</code>:</p>
  
  <pre><code>FROM gcc:7.2.0
  ENV MYP /repo
  WORKDIR ${MYP}
  COPY . ${MYP}
  
  RUN /bin/sh -c 'make'
  ENTRYPOINT ["./program"]
  CMD ["file1", "file2"]
  </code></pre>
  
  <p>So I <code>docker build -t test .</code> it and use <code>docker run test</code> and see that everything goes fine with the defaults.</p>
  
  <p>However, if I modify <code>file1</code> for instance in my working directory (after build), I note that when I run <code>docker run test file1 file2</code>, the <code>file1</code> called is the one <em>inside</em> the container, and the one entered as argument is being ignored.</p>
  
  <p>Similarly, If I use renamed data and config files, and run <code>docker run test file3 file4</code>, I get an error saying that these files does not exist (because they are not in the container).</p>
  
  <p>So, how can I do to make docker recognize these input files passed as arguments, avoiding to use the files that are <em>contained</em> in the image?</p>
  
  <p>Docker version is 18.04.0-ce, build 3d479c0af6.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Another option is to use a <code>launch.sh</code> script like:</p>
  
  <pre><code>#!/bin/sh
  ./program "${DATA_FILE}" "${CONFIG_FILE}"
  </code></pre>
  
  <p>So <code>ENTRYPOINT</code> and <code>CMD</code> instructions are replaced by the following line in the Dockerfile:</p>
  
  <pre><code>CMD ["./launch.sh"]
  </code></pre>
  
  <p>But now if I run:</p>
  
  <pre><code>docker run test -e DATA_FILE=file1 -e CONFIG_FILE=file2
  </code></pre>
  
  <p>I get a permission error...</p>
  
  <blockquote>
    <p>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.
    ERRO[0000] error waiting for container: context canceled</p>
  </blockquote>