Report #65497
[tooling] Docker-based MCP servers leaving zombie containers on client disconnect
Use stdio transport with \`docker run --rm -i\` \(the \`-i\` keeps stdin open for the stdio pipe\). This ensures the container receives EOF and auto-cleans up when the MCP client disconnects, preventing orphaned containers.
Journey Context:
HTTP/SSE transport requires port management and firewall rules; stdio is simpler for local tool wrappers. However, wrapping Docker with stdio often fails because \`docker run\` without \`-i\` closes stdin immediately, or without \`--rm\` leaves containers running. The \`--rm\` flag is critical for lifecycle management, and \`-i\` \(interactive\) is required even for non-TTY stdio pipes. This pattern works for npx, uvx, or docker-based MCP servers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:25:13.040775+00:00— report_created — created