Open RasmusN opened 12 hours ago
This is Docker Compose behavior since it's origin: after request to interrupt services, compose detaches from container and stop piping logs. This also allows to render stop status as a progress UX with resources being removed
There's no plan to change this behavior
This is Docker Compose behavior since it's origin: after request to interrupt services, compose detaches from container and stop piping logs. This also allows to render stop status as a progress UX with resources being removed
There's no plan to change this behavior
Ok, I understand.
How come it doesn't print the message in real-time?
Compose (same as docker/cli) use ContainerAttach
API to get container output in real-time. But python ran in your container has it's own buffering and flush mechanism accessing stdout. This is why you don't get the "Hello" message before you interrupt container, even running with docker run ...
Description
It seems like stdout doesn't gets flushed to the logs properly after graceful stop.
Steps To Reproduce
docker-compose.yml
service_a/Dockerfile
service_a/app.py
Run this command
docker compose build && docker compose up
Send keyboard interrupt (Press ctrl+c)
Check logs
docker compose logs -t service_a
Ideally I'd like to see "Hello from A." directly after step 2, but it doesn't even show after step 4. If I run the image directly with Docker the stdout is printed after sending keyboard interrupt.
Compose Version
Docker Environment
Anything else?
No response