title: How to install pip packages in container
body: <p>I am trying to setup a python virtual environment on a docker image running a <strong>docker build</strong></p>
  <p>The terminal output is ok when I run <strong>docker build ..</strong> but when I login into my container, no packages are installer in my virtual environment.</p>
  <pre class="lang-sh prettyprint-override"><code>#Dockerfile
  
  RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  RUN python3.8 get-pip.py
  RUN pip install virtualenv
  RUN virtualenv venv
  RUN /home/ubuntu/venv/bin/pip install -r auto/requirements.txt
  ...
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code># Docker build command
  docker build --no-cache -t auto-server:1.0 .
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code># Terminal output
  
  Step 27/27 : RUN /home/ubuntu/venv/bin/pip install -r auto/requirements.txt
   ---&gt; Running in d27dbb9a4c97
  Collecting asgiref==3.2.10
    Downloading asgiref-3.2.10-py3-none-any.whl (19 kB)
  Collecting beautifulsoup4==4.9.1
    Downloading beautifulsoup4-4.9.1-py3-none-any.whl (115 kB)
  Collecting Django==3.1.1
    Downloading Django-3.1.1-py3-none-any.whl (7.8 MB)
  
  ...
  
  Successfully installed Django-3.1.1 asgiref-3.2.10 beautifulsoup4-4.9.1 fake-useragent-0.1.11 joblib-0.16.0 numpy-1.19.2 pandas-1.1.2 python-dateutil-2.8.1 pytz-2020.1 scikit-learn-0.23.2 scipy-1.5.2 six-1.15.0 sklearn-0.0 soupsieve-2.0.1 sqlparse-0.3.1 threadpoolctl-2.1.0
  </code></pre>
  <p>Here is what I get when I list pakages in my virtual environment:</p>
  <pre class="lang-sh prettyprint-override"><code>$ docker exec -ti auto-server bash
  root@9c1f914d1b7b:/home/ubuntu# source venv/bin/activate
  (venv) root@9c1f914d1b7b:/home/ubuntu# pip list
  Package    Version
  ---------- -------
  pip        20.2.2
  setuptools 49.6.0
  wheel      0.35.1
  WARNING: You are using pip version 20.2.2; however, version 20.2.3 is available.
  You should consider upgrading via the '/home/ubuntu/venv/bin/python -m pip install --upgrade pip' command.
  
  </code></pre>
  <p>Is it the right way to do it? How to make sure packages will be installed?</p>