title: Docker file to run Python with Pandas
body: <p>I have created the following Dockerfile</p>
  
  <pre><code>FROM python
  COPY . /home
  CMD pip install pandas
  CMD mkdir /home/report
  CMD mkdir /home/data
  CMD python /home/hello.py
  </code></pre>
  
  <p>where <code>hello.py</code> is the simple Python script</p>
  
  <pre><code>name = input('What is your Name? ')
  print('Nice to meet you', name)
  
  from pandas import read_csv
  mydf = read_csv('mycsv.csv')
  print(mydf.head())
  </code></pre>
  
  <p>I then build the Docker image with <code>docker build -t myexample .</code> and run it with <code>docker run -it myexample bash</code> so as to interact with it via the shell. The building goes fine and upon running it I presented with the shell prompt, but then:</p>
  
  <ul>
  <li>No directories <code>report</code> or <code>data</code> have been created under <code>/home</code>.</li>
  <li>The last command <code>python /home/hello.py</code> does not execute on its own. I have to type it myself to get the script to run.</li>
  <li>Once I type <code>python /home/hello.py</code>, the first two lines that greet and prompt for my name are executed properly, but then an error says that pandas is unknown.</li>
  <li>It is not until I install pandas manually that the whole script runs correctly.</li>
  </ul>
  
  <p>So, in summary, it seems that none of the <code>CMD</code> statements were taken into account. What am I doing wrong?</p>