title: How can I upgrade pip inside a venv inside a Dockerfile?
body: <p>While running</p>
  
  <blockquote>
    <p>$ sudo docker build -t myproj:tag .</p>
  </blockquote>
  
  <p>I am hit with the message</p>
  
  <pre><code>You are using pip version 10.0.1, however version 18.0 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
  </code></pre>
  
  <p>and given recent occasional subtleties manifesting themselves with the error:</p>
  
  <pre><code>"/usr/bin/pip" "from pip import main" "ImportError: cannot import .."
  </code></pre>
  
  <p>I'd rather yield and indeed upgrade.</p>
  
  <p>And so I add the <code>pip upgrade</code> command in the <code>DockerFile</code>, <em>after</em> the venv is built, since the <code>pip</code> that matters is the one inside the venv (am I getting this right?). So my Dockerfile now has this:</p>
  
  <pre><code>...
  RUN python -m venv venv
  RUN pip install --upgrade pip
  ...
  </code></pre>
  
  <p>But doing so does not avoid the "You are using pip 10.x" message. What am I missing?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Though a promising suggestion, neither</p>
  
  <pre><code>RUN source venv/bin/activate
  RUN pip install --upgrade pip
  </code></pre>
  
  <p>nor</p>
  
  <pre><code>RUN source venv/bin/activate
  RUN python -m pip install --upgrade pip
  </code></pre>
  
  <p>eliminate the "You are using pip version 10.0.1, ..." message.</p>