Python app does not print anything when running detached in docker

前端 未结 11 1516
不思量自难忘°
不思量自难忘° 2020-11-29 16:54

I have a Python (2.7) app which is started in my dockerfile:

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

main.py prints some strings when it is s

11条回答
  •  囚心锁ツ
    2020-11-29 17:12

    If you want to add your print output to your Flask output when running docker-compose up, add the following to your docker compose file.

    web:
      environment:
        - PYTHONUNBUFFERED=1
    

    https://docs.docker.com/compose/environment-variables/

提交回复
热议问题