How to automate process of starting app inside docker container

I am working on an Flask REST API developed with Docker and I want to automate the whole process by which I start the application.

The whole starting process involves (on Windows):

  1. open cmd prompt

  2. enter docker exec -it container_name bash

  3. inside the container, run python main.py

Is there a way to create a bash script to run these 3 commands and keep the container window open so I can see the API logs (and run other commands)?

Thank you.

Source: Docker Questions