Skip to content

Login not persistent: $HOME mismatch between host and container #46

@just-meng

Description

@just-meng

Problem

The README states that credentials are stored in ~/.claude and login only needs to happen once. However, login is not persistent across container
restarts because the host $HOME path differs from the container user $HOME.

Details

The container launch uses:
-v "$HOME/.claude:$HOME/.claude:Z"

$HOME is expanded on the host (e.g., /home/meng), so credentials are mounted at /home/meng/.claude inside the container.

However, inside the container the user is node with HOME=/home/node. Claude Code looks for credentials at $HOME/.claude/home/node/.claude,
which is empty. So every session requires a fresh /login.

Workaround

ln -s /home/meng/.claude /home/node/.claude

(Replace /home/meng with your actual host $HOME.)

Suggested fix

Either:
1. Mount to the container user home: -v "$HOME/.claude:/home/node/.claude:Z"
2. Set HOME inside the container to match the host: --env HOME=$HOME

Option 2 is probably simplest.

Environment

- Host user: meng ($HOME=/home/meng)
- Container user: node ($HOME=/home/node)
- Using --userns=keep-id

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions