title: Cron job for docker compose
body: <p>I have a scraping script which stores the data in SQLite and needs to be run in every 20 minutes. I set the script on EC2 and when I do <code>docker-compose up</code> it works as intended, but when I set it to be run by cron job, it seems like the db is not update and the logic is not executed.</p>
  <p>Here is the <code>Dockerfile</code>:</p>
  <pre><code># syntax=docker/dockerfile:1
  
  FROM python:3.9-slim-buster
  ADD . /source
  WORKDIR /source
  RUN pip install -r requirements.txt
  RUN python3 -m pip install requests-html
  CMD [&quot;python3&quot;, &quot;-m&quot;, &quot;source.create_db.db_management&quot;]
  </code></pre>
  <p>Here is the <code>docker-compose.yml</code>:</p>
  <pre><code>version: '3'
  services:
    app:
        build: .
        volumes:
            - .:/source
  </code></pre>
  <p>and here is the cron job:</p>
  <pre><code>*/20 *  *   *   *    /home/ubuntu/order_migrator/docker-compose up
  </code></pre>