Skip to content

Commit 08d562d

Browse files
authored
docs(claude-code): fix plugins path corruption with volume overlay (#21)
## Summary - Document the `plugins/` path corruption issue when bind-mounting `~/.claude/` between host and Dev Container (see anthropics/claude-code#10379) - Replace the old "mount everything" guidance with a 2-mount approach: bind mount `~/.claude/` + overlay `plugins/` with a per-container named Docker volume (`claude-plugins-${devcontainerId}`) - Bump version to 2.1.1 ## Test plan - [ ] Rebuild a Dev Container using the new mount config - [ ] Verify plugins install without `corrupted installLocation` error - [ ] Verify conversation history, settings, and credentials persist across container restarts - [ ] Run `npx ccusage@latest` to confirm `projects/` data is accessible
2 parents 54f7894 + 36ad284 commit 08d562d

3 files changed

Lines changed: 35 additions & 11 deletions

File tree

src/claude-code/NOTES.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,34 @@ When `yoloAlias` is set to `true`, a `yolo` shell alias is created that expands
2525

2626
The native binary automatically updates in the background. Update checks are performed on startup and periodically while running. To disable auto-updates, set the `DISABLE_AUTOUPDATER=1` environment variable.
2727

28-
## Manual config for `devcontainer.json`
28+
## Persisting configuration across container rebuilds
2929

30-
Mount the local `~/.claude/` directory into the Dev Container.
31-
Add the following mount to the `devcontainer.json` file.
32-
Replace `vscode` with the actual name of your user (see `remoteUser` property).
30+
To share your Claude Code configuration, conversation history, and credentials between your host and the Dev Container, mount `~/.claude/` into the container.
3331

34-
```json
32+
**Important:** The `plugins/` subdirectory stores hardcoded absolute paths (e.g., `/home/vscode/.claude/plugins/...`). When the same directory is read from the host (where the path is `/Users/<you>/.claude/...`), these paths are invalid, causing a `corrupted installLocation` error. To avoid this, overlay `plugins/` with a per-container Docker volume.
33+
34+
Add the following to your `devcontainer.json`. Replace `/home/vscode` with the actual home directory of your remote user (see `remoteUser` property).
35+
36+
```jsonc
3537
"mounts": [
3638
{
3739
"source": "${localEnv:HOME}/.claude",
3840
"target": "/home/vscode/.claude",
3941
"type": "bind"
42+
},
43+
{
44+
"source": "claude-plugins-${devcontainerId}",
45+
"target": "/home/vscode/.claude/plugins",
46+
"type": "volume"
4047
}
4148
],
4249
```
4350

51+
- The bind mount shares your full `~/.claude/` directory (settings, credentials, conversation history, etc.) with the container.
52+
- The volume mount overlays `plugins/` with a named Docker volume, isolating it from the host. Docker creates this volume automatically on first use.
53+
- `${devcontainerId}` is unique per project and stable across rebuilds, so each Dev Container gets its own plugins volume.
54+
- `~/.claude/` must exist on the host. Run Claude Code once on your host, or create it manually: `mkdir -p ~/.claude`.
55+
4456
## Chrome Integration (`claude --chrome`)
4557

4658
Claude Code supports a Chrome integration via `claude --chrome`. To use this inside a Dev Container, combine the `claude-code` feature with the [`chrome`](https://github.com/tmaier/devcontainer-features/tree/main/src/chrome) feature configured for VNC display mode:

src/claude-code/README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,34 @@ When `yoloAlias` is set to `true`, a `yolo` shell alias is created that expands
5151

5252
The native binary automatically updates in the background. Update checks are performed on startup and periodically while running. To disable auto-updates, set the `DISABLE_AUTOUPDATER=1` environment variable.
5353

54-
## Manual config for `devcontainer.json`
54+
## Persisting configuration across container rebuilds
5555

56-
Mount the local `~/.claude/` directory into the Dev Container.
57-
Add the following mount to the `devcontainer.json` file.
58-
Replace `vscode` with the actual name of your user (see `remoteUser` property).
56+
To share your Claude Code configuration, conversation history, and credentials between your host and the Dev Container, mount `~/.claude/` into the container.
5957

60-
```json
58+
**Important:** The `plugins/` subdirectory stores hardcoded absolute paths (e.g., `/home/vscode/.claude/plugins/...`). When the same directory is read from the host (where the path is `/Users/<you>/.claude/...`), these paths are invalid, causing a `corrupted installLocation` error. To avoid this, overlay `plugins/` with a per-container Docker volume.
59+
60+
Add the following to your `devcontainer.json`. Replace `/home/vscode` with the actual home directory of your remote user (see `remoteUser` property).
61+
62+
```jsonc
6163
"mounts": [
6264
{
6365
"source": "${localEnv:HOME}/.claude",
6466
"target": "/home/vscode/.claude",
6567
"type": "bind"
68+
},
69+
{
70+
"source": "claude-plugins-${devcontainerId}",
71+
"target": "/home/vscode/.claude/plugins",
72+
"type": "volume"
6673
}
6774
],
6875
```
6976

77+
- The bind mount shares your full `~/.claude/` directory (settings, credentials, conversation history, etc.) with the container.
78+
- The volume mount overlays `plugins/` with a named Docker volume, isolating it from the host. Docker creates this volume automatically on first use.
79+
- `${devcontainerId}` is unique per project and stable across rebuilds, so each Dev Container gets its own plugins volume.
80+
- `~/.claude/` must exist on the host. Run Claude Code once on your host, or create it manually: `mkdir -p ~/.claude`.
81+
7082
## Chrome Integration (`claude --chrome`)
7183

7284
Claude Code supports a Chrome integration via `claude --chrome`. To use this inside a Dev Container, combine the `claude-code` feature with the [`chrome`](https://github.com/tmaier/devcontainer-features/tree/main/src/chrome) feature configured for VNC display mode:

src/claude-code/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "claude-code",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"name": "Claude Code",
55
"description": "Installs Claude Code CLI for AI-powered development assistance",
66
"options": {

0 commit comments

Comments
 (0)