Docker output not showing in logs for ubuntu but showing up for debian

When I make a simple Dockerfile and script like this:

FROM ubuntu
printf hello

and then run it with docker run my-img I see hello printed.

When I run this in Airflow with DockerOperator, even with tty=True, the logs don’t show the hello.

If I switch the parent image to FROM debian the output shows up as expected.

Why is this? What is the difference between the ubuntu and debian images that causes the strange output behavior? How can I make the output from ubuntu also show up in Airflow logs?

Source: StackOverflow