SShortSingh.
Back to feed

Three Common Python-in-Docker Pitfalls: Buffered Logs, Slow Shutdowns, Root-Owned Files

0
·6 views

A DEV Community article outlines three issues that often appear when Python scripts run in Docker containers after moving from a laptop to a server. Python's output buffering can hide logs from docker logs until the buffer flushes or the process exits, which the author fixes with PYTHONUNBUFFERED=1. Using shell-form CMD makes /bin/sh PID 1, so SIGTERM never reaches Python and docker stop waits the full 10 seconds before SIGKILL; switching to exec-form CMD resolves this. Running as root also causes root-owned files in bind-mounted volumes, which the author addresses by creating and switching to a non-root user, and the article closes with a combined Dockerfile template.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Declarative WebMCP in React: Snapshot Form Values Before Updating State

React state and browser-managed form fields can hold different values, causing problems when an agent fills a declarative WebMCP form. Instead of adding more synchronization effects, the example lets the DOM hold editable fields and captures a FormData snapshot at submission. React then owns only the reviewed result, which is validated before it is stored and remains unchanged by later edits. The approach is scoped to a title and date form that prepares a review result without submitting or persisting anything. The handler reads values synchronously and also responds to agent-invoked submissions through the native submit event.

0
ProgrammingDEV Community ·

Solo developer's open-source AI agent security tool passes 1,200 downloads in three months

A developer in Kolkata built AgentSec, an open-source tool that tests AI agents by simulating real attacks and reporting which tool calls violate a defined policy. The tool runs prompt-injection, poisoned tool output, fake-authority and secret-extraction scenarios, and its first real test against Claude Code exposed a vulnerability to authority-based impersonation rather than hidden instructions. Its companion package and related assets have drawn roughly 1,200 downloads and copies, all from organic channels without paid promotion. The developer says the project is now seeking real-world users and paid design partners to test agents that send emails, move money, write files or call APIs.

0
ProgrammingDEV Community ·

Terser shrinks a calculator's JavaScript from 17.8 KB to 7.8 KB

A developer who runs a small calculator website reduced a shared JavaScript file from 17.8 KB to 7.8 KB using the Terser minifier. The savings came mainly from stripping comments and whitespace, shortening local variable names, simplifying expressions, and removing dead code. The author kept the readable source as the master copy and shipped only the minified version, which matters because the file loads on every page and many visitors use slow mobile connections. After testing a full week on the live time card across desktop and phone, the totals matched the unminified version exactly. The author also warns that bugs should be fixed in the source and regenerated rather than edited in the minified output.

0
ProgrammingDEV Community ·

Cheap Android TV Boxes: A Procurement Checklist After GreedyRat Infections

Researchers at XLab found that low-cost Android TV boxes and a projector were linked to the GreedyRat malware, which turns such devices into monetizable infrastructure. They suspect an infection route through a device firmware upgrade channel that attackers could exploit to regain control. The investigation did not establish whether a vendor server was compromised or whether the vendor was involved. The resulting advice is that buyers should demand written evidence on firmware sources, update signing, support lifespan, and recovery methods rather than relying on price or marketing. Organizations are also urged to track connected devices in an inventory and verify them against external exposure data, while noting that such data does not by itself prove infection.