<p>I am new to docker and i worked in one small scenario. Situation is, i need to pass different values during each docker container creation using docker run command.</p>

<pre><code>FROM nginx:alpine
ARG files 
ENV files=$files
COPY $files /usr/share/nginx/html
</code></pre>

<p>For building docker image using <code>docker build . -t sample-ui</code> command.</p>

<p>while running the docker container, i am passing one html file like below.</p>

<pre><code>docker run -p 8090:80 -e files=sample1.html sample-ui
</code></pre>

<p>Now i just checked in browser, <a href="http://localhost:8090/sample1.html" rel="nofollow noreferrer">http://localhost:8090/sample1.html</a> and it works fine and i am able to see the sample1.html web page.</p>

<p>Now i am going to create another container on top of same docker image with different html page as environment value.</p>

<pre><code>docker run -d -p 8091:80 -e files=sample2.html sample-ui
</code></pre>

<p>But now the second container also have sample1.html only but not sample2.html. Means <a href="http://localhost:8091/sample2.html" rel="nofollow noreferrer">http://localhost:8091/sample2.html</a> is not working. <a href="http://localhost:8091/sample1.html" rel="nofollow noreferrer">http://localhost:8091/sample1.html</a> is working.</p>

<p>Anyone help me to resolve this issue.</p>

KARTHICK SANKAR
<p>From Dockerfile</p>

<pre><code>COPY $files /usr/share/nginx/html
</code></pre>

<p>This <code>COPY</code> command will execute while building the docker image using the Dockerfile. </p>

<p>While I build docker image using above <strong>Dockerfile</strong> It copied all files and directory of my current folder into <code>/user/share/nginx/html</code> folder.
To ensure run following:</p>

<pre><code>docker exec -it &lt;container id&gt; sh
/ # ls /user/share/nginx/html
</code></pre>

<blockquote>
  <p>Now i just checked in browser, <a href="http://localhost:8090/sample1.html" rel="nofollow noreferrer">http://localhost:8090/sample1.html</a> and it works fine and i am able to see the sample1.html web page.</p>
</blockquote>

<p>So, In your case there might be <code>sample1.html</code> filed present while you are building image. That's why above url working.</p>

<p><code>sample2.html</code> was not present, so it's not working</p>
