Python app does not print anything when running detached in docker

前端 未结 11 1480
不思量自难忘°
不思量自难忘° 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:20

    If you aren't using docker-compose and just normal docker instead, you can add this to your Dockerfile that is hosting a flask app

    ARG FLASK_ENV="production"
    ENV FLASK_ENV="${FLASK_ENV}" \
        PYTHONUNBUFFERED="true"
    
    CMD [ "flask", "run" ]
    

提交回复
热议问题