Skip to content

Fix HOME defaulting to CWD inside container (#36)#55

Closed
yarikoptic wants to merge 1 commit intomainfrom
bf-HOME
Closed

Fix HOME defaulting to CWD inside container (#36)#55
yarikoptic wants to merge 1 commit intomainfrom
bf-HOME

Conversation

@yarikoptic
Copy link
Copy Markdown
Member

I tested on a few sessions - seems to work nice ! Might have "unsandboxing" effect though since now ~/.claude is user's claude so changes do persist

With --userns=keep-id, the host UID has no /etc/passwd entry in the container, so podman defaults HOME to the working directory. This causes several problems:

  • ~/.claude resolves to $CWD/.claude instead of the mounted config dir
  • Node.js os.homedir() === process.cwd(), so Claude Code treats every workspace as "running from home directory"
  • Workspace trust acceptance is only session-scoped (never persisted), causing the "trust this folder?" dialog on every launch

Explicitly set HOME=/home/node (the Dockerfile's user home with shell configs) so that HOME is stable regardless of workspace. Claude Code's config is found via CLAUDE_CONFIG_DIR which is already set independently.

With --userns=keep-id, the host UID has no /etc/passwd entry in the
container, so podman defaults HOME to the working directory. This causes
several problems:

- ~/.claude resolves to $CWD/.claude instead of the mounted config dir
- Node.js os.homedir() === process.cwd(), so Claude Code treats every
  workspace as "running from home directory"
- Workspace trust acceptance is only session-scoped (never persisted),
  causing the "trust this folder?" dialog on every launch

Explicitly set HOME=/home/node (the Dockerfile's user home with shell
configs) so that HOME is stable regardless of workspace. Claude Code's
config is found via CLAUDE_CONFIG_DIR which is already set independently.

Co-Authored-By: Claude Code 2.1.81 / Claude Opus 4.6 <noreply@anthropic.com>
@just-meng
Copy link
Copy Markdown
Contributor

See my comment here: #46 (comment)

@asmacdo
Copy link
Copy Markdown
Member

asmacdo commented Mar 31, 2026

(list for expand link hack)

@yarikoptic if that works for you lets close this one.

@yarikoptic
Copy link
Copy Markdown
Member Author

#61 fixed it properly I think

@yarikoptic yarikoptic closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Makes current directory $HOME thus leading to appearance of various folders

3 participants