title: COPY .tar.gz needed in Dockefile or not?
body: <p>Docker newbie here, quick question about the COPY command while dockerizing Django.</p>
  <p>I thought the COPY command is used to copy over a local file into the Docker container/context or else, as far as Docker is concerned, during the build the file does not exist.</p>
  <p>The development Dockerfile from the tutorial I'm following had this section:</p>
  <pre><code># install dependencies
  RUN pip install --upgrade pip
  COPY ./requirements.txt .
  RUN pip install -r requirements.txt
  </code></pre>
  <p>So I understood that without that COPY command during the build the second RUN command would fail because it has no idea what requirements.txt is. Therefore, since I wanted to install my django-polls app tarball, I added a COPY and tacked on the phrase to the second RUN:</p>
  <pre><code># install dependencies
  COPY ./requirements.txt .
  COPY ./django-polls-0.1.tar.gz .
  RUN pip install --upgrade pip &amp;&amp; pip install -r requirements.txt &amp;&amp; pip install django-polls-0.1.tar.gz
  </code></pre>
  <p>As you can see, I combined the two RUN commands, added the COPY .tar.gz line, and tacked the .tar.gz installation on to the end of the RUN command. So I have 2 questions, the second one being more of the focus of this post:</p>
  <ol>
  <li><p>Was it necessary to move the <code>pip install --upgrade pip</code> into the final RUN command? I understand that two different RUN commands do not affect each other, therefore the original, first RUN was doing nothing.</p>
  </li>
  <li><p>Was it necessary to add the second COPY command? I ask because I thought it was, but then I realize I omitted it in my production Dockerfile and it was still able to install django-polls.</p>
  </li>
  </ol>
  <p>That is, my production Dockerfile has these lines:</p>
  <pre><code># install dependencies
  COPY ./requirements.txt .
  RUN pip install --upgrade pip &amp;&amp; pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt &amp;&amp; pip install django-polls-0.1.tar.gz
  </code></pre>
  <p>And even without a <code>COPY ./django-polls-0.1.tar.gz .</code> line, it was able to install django-polls. What am I not understanding here?</p>
  <p>Thanks</p>