Sometimes, we want to fix Python app does not print anything when running detached in Docker.
In this article, we’ll look at how to fix Python app does not print anything when running detached in Docker.
How to fix Python app does not print anything when running detached in Docker?
To fix Python app does not print anything when running detached in Docker, we run python
with the -u
flag in our Dockerfile.
For instance, we write
CMD ["python","-u","main.py"]
to run main.py with -u to use unbuffered output.
conclusion
To fix Python app does not print anything when running detached in Docker, we run python
with the -u
flag in our Dockerfile.