Add pip requirements to docker image in runtime
<p>I want to be able to add some extra requirements to an own create docker image. My strategy is build the image from a dockerfile with a CMD command that will execute a "pip install -r" command using a mounted volume in runtime.</p>

<p>This is my dockerfile:</p>

<pre><code>FROM ubuntu:14.04

RUN apt-get update
RUN apt-get install -y python-pip python-dev build-essential 
RUN pip install --upgrade pip

WORKDIR /root

CMD ["pip install -r /root/sourceCode/requirements.txt"]
</code></pre>

<p>Having that dockerfile I build the image:</p>

<pre><code>sudo docker build -t test .
</code></pre>

<p>And finally I try to attach my new requirements using this command:</p>

<pre><code>sudo docker run -v $(pwd)/sourceCode:/root/sourceCode -it test /bin/bash
</code></pre>

<p>My local folder "sourceCode" has inside a valid requirements.txt file (it contains only one line with the value "gunicorn"). 
When I get the prompt I can see that the requirements file is there, but if I execute a pip freeze command the gunicorn package is not listed.</p>

<p>Why the requirements.txt file is been attached correctly but the pip command is not working properly?</p>