原创 Python 在 Docker 下如何开启日志输出

Using unbuffered output with

CMD ["python","-u","main.py"] instead of

CMD ["python","main.py"]

-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x see man page for details on internal buffering relating to '-u'

reference