Fix Claude Code hanging in hardened container

Claude Code writes to ~/.claude.json, ~/.cache/, and ~/.npm/ which
failed silently on the read-only root filesystem. Add tmpfs at
/home/storkit so the home dir is writable (the claude-state volume
overlays on top for persistent .claude/ data).

Also fix .dockerignore: use **/target/ to match nested target dirs,
add .storkit/logs/ and **/node_modules/ to prevent multi-GB build
context transfers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Timmy
2026-03-21 21:16:24 +00:00
parent 3774c3dca7
commit 9f873dc839
3 changed files with 19 additions and 3 deletions

11
.dockerignore Normal file
View File

@@ -0,0 +1,11 @@
# Docker build context exclusions
**/target/
**/node_modules/
frontend/dist/
.storkit/worktrees/
.storkit/logs/
.storkit/work/6_archived/
.git/
*.swp
*.swo
.DS_Store

View File

@@ -1,8 +1,9 @@
# Docker build context exclusions # Docker build context exclusions
target/ **/target/
frontend/node_modules/ **/node_modules/
frontend/dist/ frontend/dist/
.storkit/worktrees/ .storkit/worktrees/
.storkit/logs/
.storkit/work/6_archived/ .storkit/work/6_archived/
.git/ .git/
*.swp *.swp

View File

@@ -72,11 +72,15 @@ services:
read_only: true read_only: true
tmpfs: tmpfs:
- /tmp:size=512M - /tmp:size=512M
- /home/storkit/.npm:size=256M - /home/storkit:size=512M
# Drop all Linux capabilities, then add back only what's needed. # Drop all Linux capabilities, then add back only what's needed.
# SETUID/SETGID needed by Claude Code's PTY allocation (openpty).
cap_drop: cap_drop:
- ALL - ALL
cap_add:
- SETUID
- SETGID
# Prevent child processes from gaining new privileges via setuid, # Prevent child processes from gaining new privileges via setuid,
# setgid, or other mechanisms. # setgid, or other mechanisms.