René's URL Explorer Experiment


Title: Example Dockerfile should document to run python unbuffered · Issue #604 · docker-library/python · GitHub

Open Graph Title: Example Dockerfile should document to run python unbuffered · Issue #604 · docker-library/python

X Title: Example Dockerfile should document to run python unbuffered · Issue #604 · docker-library/python

Description: The example Dockerfile in the Create a Dockerfile in your python App Project section in the image documentation should have ENV PYTHONUNBUFFERED=1 or add the -u option to CMD [ "python", "-u", "./your-daemon-or-script.py" ] From https://...

Open Graph Description: The example Dockerfile in the Create a Dockerfile in your python App Project section in the image documentation should have ENV PYTHONUNBUFFERED=1 or add the -u option to CMD [ "python", "-u", "./y...

X Description: The example Dockerfile in the Create a Dockerfile in your python App Project section in the image documentation should have ENV PYTHONUNBUFFERED=1 or add the -u option to CMD [ "python", ...

Opengraph URL: https://github.com/docker-library/python/issues/604

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Example Dockerfile should document to run python unbuffered","articleBody":"The example Dockerfile in the [Create a Dockerfile in your python App Project](https://github.com/docker-library/docs/blob/master/python/content.md#create-a-dockerfile-in-your-python-app-project) section in the image documentation should have\r\n\r\n```Dockerfile\r\nENV PYTHONUNBUFFERED=1\r\n```\r\nor add the `-u` option to \r\n```Dockerfile\r\nCMD [ \"python\", \"-u\", \"./your-daemon-or-script.py\" ]\r\n```\r\n\r\nFrom https://docs.python.org/3/library/sys.html#sys.stdout:\r\n\r\n> When interactive, the `stdout` stream is line-buffered. Otherwise, it is block-buffered like regular text files. The `stderr` stream is line-buffered in both cases. You can make both streams unbuffered by passing the `-u` command-line option or setting the `PYTHONUNBUFFERED` environment variable.\r\n**Changed in version 3.9: Non-interactive stderr is now line-buffered instead of fully buffered.**\r\n\r\nWhen running a container non-interactively, no output from the python script or daemon are flushed to `stdout` until the block buffer is full (generally `DEFAULT_BUFFER_SIZE = 8192`) or the container terminates. For daemons which do not terminate and which may not have much logging over its lifetime, nothing may be logged at all. \r\n\r\nThis makes viewing / tailing the container logs in realtime which by default captures stdout problematic, especially when viewing the logs in conjunction with other services.\r\n\r\nExample `docker-compose.yaml` which demonstrates this issue.\r\n\r\n```yaml\r\n---\r\nservices:\r\n  demo:\r\n    image: python:3\r\n    command:\r\n      - python\r\n      - -c\r\n      - |\r\n        import time\r\n        for i in range(10):\r\n            print(i)\r\n            time.sleep(1)\r\n```\r\nNo output is written until the container terminates.\r\n\r\nIt took me a while to figure out what the problem was, believing it was a problem with Docker not flushing logs to the driver (with `--log-opt mode=non-blocking`) or getting blocked (with `--log-opt mode=blocking` - the default), until I realised it was a problem specific to Python. Adding changes to the Python image documentation would help users with similar problems. E.g. https://github.com/moby/moby/issues/12447#issuecomment-94416623 and https://stackoverflow.com/questions/29663459/python-app-does-not-print-anything-when-running-detached-in-docker\r\n\r\nThe Docker Python Guide docs, https://docs.docker.com/language/python/build-images/ should also be updated.","author":{"url":"https://github.com/tmoschou","@type":"Person","name":"tmoschou"},"datePublished":"2021-04-17T03:40:19Z","url":"https://github.com/docker-library/python/issues/604"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c3456b0d-8c56-68ac-f266-470540c6378b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8916:22BB81:CC5CBA:10C2E4F:6AFE8B70
html-safe-noncefb6dbf9247368ca1e0034c4a10e9c3046ec5c0af0a0a3f310616c0ea397322d4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTE2OjIyQkI4MTpDQzVDQkE6MTBDMkU0Rjo2QUZFOEI3MCIsInZpc2l0b3JfaWQiOiI3Mjk2ODUzMDExOTQxMTk4NzA0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac620d6231ba41d10a64ff71f835da4378494402c52fc1e280836bc945fc1e0e60
hovercard-subject-tagissue:860314217
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/docker-library/python/604/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2694b9617b55f75e18266d6ae549f913218c05cacbd8c31fb05eb0021ffeb1f6/docker-library/python/issues/604
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2694b9617b55f75e18266d6ae549f913218c05cacbd8c31fb05eb0021ffeb1f6/docker-library/python/issues/604
og:image:altThe example Dockerfile in the Create a Dockerfile in your python App Project section in the image documentation should have ENV PYTHONUNBUFFERED=1 or add the -u option to CMD [ "python", "-u", "./y...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametmoschou
hostnamegithub.com
expected-hostnamegithub.com
Noneb3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86
turbo-cache-controlno-preview
go-importgithub.com/docker-library/python git https://github.com/docker-library/python.git
octolytics-dimension-user_id7739233
octolytics-dimension-user_logindocker-library
octolytics-dimension-repository_id21054928
octolytics-dimension-repository_nwodocker-library/python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id21054928
octolytics-dimension-repository_network_root_nwodocker-library/python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4a10310af51a1bfffbedc4fd81cb582acf0cb0ff
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/docker-library/python/issues/604#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdocker-library%2Fpython%2Fissues%2F604
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdocker-library%2Fpython%2Fissues%2F604
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=docker-library%2Fpython
Reloadhttps://github.com/docker-library/python/issues/604
Reloadhttps://github.com/docker-library/python/issues/604
Reloadhttps://github.com/docker-library/python/issues/604
docker-libraryhttps://github.com/docker-library
pythonhttps://github.com/docker-library/python
Codehttps://github.com/docker-library/python
Issues23 (23)https://github.com/docker-library/python/issues
Pull requests5 (5)https://github.com/docker-library/python/pulls
Discussionshttps://github.com/docker-library/python/discussions
Actionshttps://github.com/docker-library/python/actions
Projectshttps://github.com/docker-library/python/projects
Security and qualityhttps://github.com/docker-library/python/security
Insightshttps://github.com/docker-library/python/insights
https://github.com/docker-library/python
New issuehttps://github.com/login?return_to=https://github.com/docker-library/python/issues/604
New issuehttps://github.com/login?return_to=https://github.com/docker-library/python/issues/604
Example Dockerfile should document to run python unbufferedhttps://github.com/docker-library/python/issues/604#top
https://github.com/tmoschou
tmoschouhttps://github.com/tmoschou
on Apr 17, 2021https://github.com/docker-library/python/issues/604#issue-860314217
Create a Dockerfile in your python App Projecthttps://github.com/docker-library/docs/blob/master/python/content.md#create-a-dockerfile-in-your-python-app-project
https://docs.python.org/3/library/sys.html#sys.stdouthttps://docs.python.org/3/library/sys.html#sys.stdout
moby/moby#12447 (comment)https://github.com/moby/moby/issues/12447#issuecomment-94416623
https://stackoverflow.com/questions/29663459/python-app-does-not-print-anything-when-running-detached-in-dockerhttps://stackoverflow.com/questions/29663459/python-app-does-not-print-anything-when-running-detached-in-docker
https://docs.docker.com/language/python/build-images/https://docs.docker.com/language/python/build-images/
https://github.com/daveisfera
daveisferahttps://github.com/daveisfera
on Nov 16, 2021https://github.com/docker-library/python/issues/604#issuecomment-970427531
https://github.com/nijave
nijavehttps://github.com/nijave
on Dec 11, 2023https://github.com/docker-library/python/issues/604#issuecomment-1850271699
https://github.com/Sbrjt
Sbrjthttps://github.com/Sbrjt
on Jun 27, 2025https://github.com/docker-library/python/issues/604#issuecomment-3013037344
https://github.com/vivodi
vivodihttps://github.com/vivodi
on Oct 11, 2026https://github.com/docker-library/python/issues/604#issuecomment-6110557526
Sign up for freehttps://github.com/signup?return_to=https://github.com/docker-library/python/issues/604
Sign in to commenthttps://github.com/login?return_to=https://github.com/docker-library/python/issues/604
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.