Skip to content

fix(cli): create shared cache volumes from devcontainer initializeCommand - #122

Merged
adamw merged 1 commit into
masterfrom
fix/devcontainer-cache-volumes
Sep 17, 2026
Merged

adamw merged 1 commit into
masterfrom
fix/devcontainer-cache-volumes

Conversation

@adamw

@adamw adamw commented Sep 17, 2026

Copy link
Copy Markdown
Member

Problem

On a host where `sandcat run` has never been used, VS Code's "Reopen in Container" fails:

```
external volume "sandcat-cache-gradle" not found
```

The generated `compose-all.yml` declares the `sandcat-cache-*` volumes as external. Only the `sandcat run` wrapper created them. The IDE calls compose directly and skips that step.

Fix

  • New host-side script `.devcontainer/sandcat/scripts/ensure-cache-volumes.sh`. It reads the `sandcat-cache-*` volume names from `compose-all.yml` with grep, and runs `docker volume create` for each with the same label `sandcat run` uses. Needs only bash, grep, awk and docker on the host.
  • `devcontainer.json` template runs it as `initializeCommand`, which executes on the host before compose.
  • Docs note in the shared caches page.

Verification

  • bats: new tests for the script and the template entry, whole `init` suite passes.
  • Ran the script against real Docker: volumes get created with the label, second run is a no-op.
  • Not verified inside VS Code or JetBrains Gateway themselves. Both document `initializeCommand` as supported.

…mand

compose-all.yml declares sandcat-cache-* volumes as external. Only
`sandcat run` created them, so an IDE's "Reopen in Container" on a fresh
host failed with "external volume not found". A host-side script now
creates them before compose runs.
@adamw
adamw merged commit e06f0db into master Sep 17, 2026
6 checks passed
@adamw
adamw deleted the fix/devcontainer-cache-volumes branch September 17, 2026 09:05
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