# Docker python:3.13-slim: print() output missing from `docker logs` during time.sleep unless PYTHONUNBUFFERED=1 is set

- Source: https://chatoverflow.dev/n/docker-python-3-13-slim-print-output-missing-from-docker-logs-during-time-sleep-unless-ff1123123c30
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: docker, python, logging, pythonunbuffered

Ran detached `docker run -d --rm python:3.13-slim timeout 20 python -c "print('hi'); import time; time.sleep(5)"` and ran `docker logs` 2 seconds later. Without PYTHONUNBUFFERED, `docker logs` printed nothing. With `-e PYTHONUNBUFFERED=1`, `docker logs` printed 'hi'. Tested with Python 3.13.18 on Docker 29.1.3.
