[Bug] KillShell tool terminates entire Claude instance in Docker containers
Bug Description
Bug Report: KillShell tool terminates entire Claude instance in Docker containers
Version: Claude Code 2.0.76
Environment: Docker container using node:20-bookworm-slim base image with dumb-init as entrypoint
Severity: Critical - causes complete instance termination
Description
When running Claude Code inside a Docker container, using the KillShell tool on any background process terminates not just the target process, but the entire Claude instance.
Steps to Reproduce
- Run Claude Code in a Docker container with this setup:
FROM node:20-bookworm-slim
RUN apt-get update && apt-get install -y dumb-init
RUN npm install -g @anthropic-ai/claude-code
ENTRYPOINT ["dumb-init", "--", "claude", "--dangerously-skip-permissions"]
- Start any background process:
node -e "setInterval(() => {}, 1000)" &
- Use the KillShell tool on the background shell ID
- Result: Entire Claude instance terminates, returning to host shell
Investigation Findings
Manual process killing works correctly and does NOT crash the instance:
- kill -TERM $PID works correctly
- kill -KILL $PID works correctly
- kill -TERM -$PGRP (process group kill) works correctly
Process isolation is correct:
- Background processes are properly reparented to dumb-init (PID 1)
- Process groups and session IDs are correctly separated
- dumb-init signal forwarding is working as expected
Conclusion: The bug is in the KillShell tool's internal implementation, not in container signal handling or process management.
Workaround
Use manual bash kill instead of KillShell:
kill $PID
Additional Context
- Bug does NOT occur when running Claude Code outside Docker containers
- Reproducible across multiple container configurations (tested with three separate Dockerfiles)
- All containers use identical setup: dumb-init -> start.sh -> exec claude
Environment Info
- Platform: linux
- Terminal: wsl-Ubuntu
- Version: 2.0.76
- Feedback ID:
Errors
[{"error":"Error\n at ry (/$bunfs/root/claude:58:1144)\n at <anonymous> (/$bunfs/root/claude:59:10093)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:862:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:61:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-05T01:32:05.289Z"},{"error":"Error: NON-FATAL: Lock acquisition failed for /home/jonnymanchild/.local/share/claude/versions/2.0.76 (expected in multi-process scenarios)\n at W3$ (/$bunfs/root/claude:2427:2165)\n at TTA (/$bunfs/root/claude:2427:1885)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-05T01:32:05.868Z"},{"error":"Error\n at ry (/$bunfs/root/claude:58:1144)\n at <anonymous> (/$bunfs/root/claude:59:10093)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:862:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:61:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-05T01:32:06.533Z"},{"error":"Error\n at ry (/$bunfs/root/claude:58:1144)\n at <anonymous> (/$bunfs/root/claude:59:10093)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:862:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:61:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-05T01:32:41.357Z"},{"error":"Error\n at ry (/$bunfs/root/claude:58:1144)\n at <anonymous> (/$bunfs/root/claude:59:10093)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:862:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:61:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-05T01:33:16.156Z"},{"error":"Error: Request was aborted.\n at _createMessage (/$bunfs/root/claude:455:3157)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-05T01:34:03.641Z"},{"error":"Error\n at ry (/$bunfs/root/claude:58:1144)\n at <anonymous> (/$bunfs/root/claude:59:10093)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:862:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:61:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-05T01:34:29.619Z"},{"error":"Error: Request was aborted.\n at _createMessage (/$bunfs/root/claude:455:3157)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-05T01:40:31.593Z"},{"error":"Error\n at ry (/$bunfs/root/claude:58:1144)\n at <anonymous> (/$bunfs/root/claude:59:10093)\n at emit (node:events:92:22)\n at endReadab
Note: Error logs were truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗