0

I've got a Docker Container setup that includes two python programs running at the same time.

  • Process A is a web server supported by flask that selects data from an SQLITE DB and puts it on a static page
  • Process B is a program which retrieves data from a webpage, parses it, processes it (triggering SMS alerts), caches the results, stores new results in a db, and prints the processed data in a couple different ways. Process B runs on an interval every 45 seconds within the Python program itself using a while loop like such:
while True:
   # do_something
   sleep(45)

Both processes function perfectly fine. There are no errors with printing and in fact I receive real-time alerts and I can validate the timestamps of the DB inserts are on those 45 second intervals. Though the "logs" from docker-compose up seem to be queued. At times there will be no movement and then suddenly an hour's worth of print statements are generated?

The docker container is running on a Raspberry Pi 3+ (Ubuntu Server 20.04 LTS) and using htop I can see that the container barely registers 0.1% CPU usage and about 3.4% memory usage.

My version of Docker is: Docker version 20.10.5, build 55c4c88


When I access website powered by Process A it registers those logs immediately but I think this is because it is accessing the network. I don't have any logs setup to print in Flask.

Process A and Process B are under the same service and are invoked by the script provided in the docker docs on running multiple processes: https://docs.docker.com/config/containers/multi-service_container/

1 Answer 1

0

After a little bit of digging the question was already asked and answered here: https://stackoverflow.com/questions/51362213/docker-compose-not-printing-stdout-in-python-app

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .