About the matter that the contents of Python print are not visible in docker logs

There is a Dockerfile as below

CMD ["python", "/app.py"]

ʻApp.py` has this:

print 'some log'

Start with docker run:

docker run -d xxx

Look at the Log:

docke logs -f yyy

It's hard to get the expected Log.

I found that it was caused by the standard output buffer by Python.

If you want to see the Log immediately without buffering, just launch the app with python -u.

After modifying the following, docker logs was able to see the Log safely.

CMD ["python", "-u", "/app.py"]

Recommended Posts

About the matter that the contents of Python print are not visible in docker logs
Not being aware of the contents of the data in python
The contents of the Python tutorial (Chapter 5) are itemized.
The contents of the Python tutorial (Chapter 4) are itemized.
The contents of the Python tutorial (Chapter 2) are itemized.
The contents of the Python tutorial (Chapter 8) are itemized.
The contents of the Python tutorial (Chapter 1) are itemized.
The contents of the Python tutorial (Chapter 10) are itemized.
[Note] About the role of underscore "_" in Python
About the behavior of Model.get_or_create () of peewee in Python
The contents of the Python tutorial (Chapter 6) are itemized.
The contents of the Python tutorial (Chapter 3) are itemized.
About the matter that softmax is not needed at the end of Torchvision model.
About the problem that the python version of Google App Engine does not mesh
A reminder about the implementation of recommendations in Python
About the ease of Python
About the features of Python
The story that `while queue` did not work in python
Pit pits that logs are not rotated in Fedora 33 (beta)
A Python script that compares the contents of two directories
About the matter that nosetests does not pass when __init__.py is created in the project directory
How to check if the contents of the dictionary are the same in Python by hash value
Not surprisingly known! ?? What about the arguments of built-in functions? What school are you from? [Python]
Output the contents of ~ .xlsx in the folder to HTML with Python
A function that measures the processing time of a method in python
The story that 2D list replacement did not work in python
Verification of the theory that "Python and Swift are quite similar"
About the basics list of Python basics
[Python] A program that rotates the contents of the list to the left
About bit full search that often appears in competition pros From the eyes of beginners with python
Use features that are no longer visible on the UI in Slack
python> does not include the letters mm> if "mm" not in text: / print "not including mm"
About the case that the speaker did not make sound in Ubuntu LTS 20.04
How to compare if the contents of the objects in scipy.sparse.csr_matrix are the same
I checked the contents of docker volume
Check the behavior of destructor in Python
About the virtual environment of python version 3.7
The result of installing python in Anaconda
The basics of running NoxPlayer in Python
In search of the fastest FizzBuzz in Python
[Python] Summary of functions that return the index that takes the closest value in the array
Talking about the features that pandas and I were in charge of in the project
I was in trouble because the behavior of docker container did not change
About the matter that localhost: 4040 cannot be accessed after running Spark with Docker
[Question] Python string replacement.replace () will replace even the ones that are not specified.
How to find the coefficient of the trendline that passes through the vertices in Python
Examples and solutions that the Python version specified in pyenv does not run
Get the contents of git diff from python
Output the number of CPU cores in Python
[Python] Sort the list of pathlib.Path in natural sort
Prepare the execution environment of Python3 with Docker
Check if the characters are similar in Python
Get the caller of a function in Python
Match the distribution of each group in Python
What is wheezy in the Docker Python image?
View the result of geometry processing in Python
About the matter that was worried about sampling error
Make a copy of the list in Python
About the difference between "==" and "is" in python
A note about the python version of python virtualenv
Find the divisor of the value entered in python