Skip to content

Keep gems, the gh login and Claude Code state in shared volumes - #2

Merged
pedantic-git merged 3 commits into
mainfrom
feature/shared-home-volumes
Nov 3, 2026
Merged

pedantic-git merged 3 commits into
mainfrom
feature/shared-home-volumes

Conversation

@pedantic-git

Copy link
Copy Markdown
Member

Anything in a devcontainer's home directory is lost when it's rebuilt, so every rebuild reinstalled every gem and logged gh and Claude Code out, losing Claude's memory and sessions with them. This moves that state into named volumes shared by every project on the machine.

  • Rails image: sets BUNDLE_PATH=/home/vscode/.gems, BUNDLE_CLEAN=false and CLAUDE_CONFIG_DIR=/home/vscode/.claude, and creates the mount points owned by vscode, so each new volume gets that ownership on first mount.
  • Node image: the same for Claude Code, and it mounts the bun, gh and Claude volumes through its metadata.
  • Rails projects declare the volumes in their own compose.yaml. The README explains why the image can't do this for compose-based projects.
  • bin/migrate-to-shared-volumes copies the Claude Code and gh state from existing devcontainers into the volumes before they're rebuilt.
  • README: documents the volumes and their caveats: never bundle clean, gem list vs bundle list, credentials shared across projects, and what removing a volume loses.

Tested locally:

  • On a built Rails image, fresh volumes mount owned by vscode, and bundle install installs into /home/vscode/.gems/ruby/4.0.0.
  • Run against shufflehorse's container with throwaway volume names, the migration script copied ~/.claude, ~/.claude.json and ~/.config/gh with their permissions intact, and a second run kept the existing files.

🤖 Generated with Claude Code

Anything in a container's home directory is lost on rebuild, so every
rebuild reinstalled every gem and logged gh and Claude Code out. The
images now point Bundler and Claude Code at volume mount points, the
Node image mounts the volumes itself, and the README covers the
caveats and how to migrate existing containers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pedantic-git and others added 2 commits November 3, 2026 12:18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pedantic-git
pedantic-git merged commit 1971352 into main Nov 3, 2026
3 checks passed
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.

1 participant