is it possible to run a cronjob to execute a python script in a MySQL docker conatiner? Or should I create an Ubuntu docker container and install MySQL there?
You can run a python script in your MySQL Docker Container. In order to do that you have to install crontab and python client in order to execute the script. It will look something like this:
FROM mysql:latest
RUN apt-get update \
&& apt-get install -y cron python
COPY ./YOUR_SCRIPT.py /YOUR_SCRIPT.py
RUN chmod +x /YOUR_SCRIPT.py #MAKE SCRIPT EXECUTABLE
RUN crontab -l | { cat; echo "* * * * * /YOUR_SCRIPT.py"; } | crontab -
ENTRYPOINT ["/YOUR_SCRIPT.py"]