It works with this configuration:
Using unbuffered output in dockerfile with
CMD ["python","-u","main.py"]