Interview Prep/Docker/Containers that exit, crash or misbehave

Python app prints nothing to `docker logs` until the container stops.

IntermediateTroubleshootingContainers that exit, crash or misbehave
Answer

Likely causes → stdout buffering when not attached to a TTY.

Diagnose → Compare docker run -t vs -d.

Fix → ENV PYTHONUNBUFFERED=1 or python -u; configure logging handlers to stream.

Prevent → Set the variable in the base image.

All Docker questions Roadmap: Docker & containers

More on Containers that exit, crash or misbehave