title: Python dependencies and Docker and Crontab
body: <p>I'm having a strange issue when trying to run a Python script via Crontab within a Docker container. Here's the setup.</p>
  
  <p>I have a Dockerfile like this:</p>
  
  <pre><code>FROM python:3-onbuild
  
  # Install cron and dependencies
  RUN apt-get update &amp;&amp; apt-get -y install cron
  
  # Add crontab file in the cron directory
  ADD crontab /etc/cron.d/simple-cron
  WORKDIR /src
  COPY . /src
  
  # Give execution rights on the cron job
  RUN chmod 0644 /etc/cron.d/simple-cron
  RUN chmod 777 /usr/local/lib/python3.6/site-packages
  
  # Create the log file to be able to run tail
  RUN touch /var/log/cron.log
  
  # Run the command on container startup
  CMD ["cron", "-f"]
  </code></pre>
  
  <p>And a crontab file like this:</p>
  
  <pre><code>* * * * * root python /src/test.py &gt; /proc/1/fd/1 2&gt;/proc/1/fd/2
  </code></pre>
  
  <p>This executes correctly with no problems when I start the container. The first line of my Python file is <code>import redis</code>, which causes the script to fail, saying that the module cannot be found.</p>
  
  <p>The interesting thing is that when I manually execute <code>docker exec -it [container_name] python test.py</code>, everything works exactly as expected.</p>
  
  <p>What could be the issue here? I'm thinking that the requirements file isn't being installed to the right location?</p>