Document data persistence and storage locations
This commit is contained in:
+18
-8
@@ -103,18 +103,28 @@ opencode
|
|||||||
| `GIT_USER_NAME` | Git commit author name |
|
| `GIT_USER_NAME` | Git commit author name |
|
||||||
| `GIT_USER_EMAIL` | Git commit author email |
|
| `GIT_USER_EMAIL` | Git commit author email |
|
||||||
|
|
||||||
## Volumes
|
## Data Storage and Persistence
|
||||||
|
|
||||||
| Host Path | Container Path | Purpose |
|
Understanding what survives container restarts and what doesn't:
|
||||||
|---|---|---|
|
|
||||||
| Your project directory | `/workspace` | Code you want to work on |
|
| Path in container | Source | Survives restart? | Contains |
|
||||||
| `~/.ssh` | `/home/developer/.ssh:ro` | SSH keys for git (read-only) |
|
|---|---|---|---|
|
||||||
| (optional) `~/.aws` | `/home/developer/.aws:ro` | AWS credentials/config |
|
| `/workspace` | Host bind mount | ✅ Yes — lives on host | Your project files |
|
||||||
| (optional) Custom config | `/home/developer/.config/opencode/opencode.json:ro` | Full opencode config with MCP servers, etc. |
|
| `/home/developer/.ssh` | Host bind mount (ro) | ✅ Yes — lives on host | SSH keys |
|
||||||
|
| `/home/developer/.local/share/opencode` | Named volume (if configured) | ✅ Yes — Docker volume | Session history, memory, auth tokens |
|
||||||
|
| `/home/developer/.config/opencode/opencode.json` | Generated by entrypoint | ❌ No — regenerated each start | Provider config, MCP server definitions |
|
||||||
|
| `/home/developer/.aws` | Host bind mount (if configured) | ✅ Yes — lives on host | AWS credentials/SSO cache |
|
||||||
|
|
||||||
|
### Key points
|
||||||
|
|
||||||
|
- **Project files** (`/workspace`) are always safe — they're your host filesystem.
|
||||||
|
- **opencode config** is auto-generated from `OPENCODE_PROVIDER` env var on each start. It only sets provider and model — no MCP servers. To persist MCP server config, mount your own config file (see Custom opencode Config below).
|
||||||
|
- **opencode data** (session history, memory) is lost with `--rm` unless you add a named volume.
|
||||||
|
- **AWS SSO tokens** are stored inside the container and lost on restart. Re-run `aws sso login` after restarting.
|
||||||
|
|
||||||
### Persisting opencode data
|
### Persisting opencode data
|
||||||
|
|
||||||
To keep opencode state (session history, memory) between runs, add a named volume:
|
Add a named volume to keep session history and memory between runs:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it --rm \
|
docker run -it --rm \
|
||||||
|
|||||||
@@ -197,6 +197,20 @@ Container (Debian bookworm)
|
|||||||
└── /workspace ← your code lives here
|
└── /workspace ← your code lives here
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Data persistence
|
||||||
|
|
||||||
|
| Path in container | Source | Survives `--rm`? | Contains |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `/workspace` | Host bind mount | ✅ Yes | Your project files |
|
||||||
|
| `/home/developer/.ssh` | Host bind mount (ro) | ✅ Yes | SSH keys |
|
||||||
|
| `/home/developer/.local/share/opencode` | Named volume `devbox-data` | ✅ Yes | Session history, memory |
|
||||||
|
| `/home/developer/.config/opencode/opencode.json` | Generated by entrypoint | ❌ No | Provider/model config |
|
||||||
|
| `/home/developer/.aws` | Not mounted by default | ❌ No | AWS SSO tokens |
|
||||||
|
|
||||||
|
**opencode config** (`opencode.json`) is auto-generated from `OPENCODE_PROVIDER` on each start. It sets provider and model only — no MCP servers. To use MCP servers or custom settings, mount your own config file (see Custom opencode config above).
|
||||||
|
|
||||||
|
To persist AWS SSO sessions across restarts, uncomment the `~/.aws` volume mount in `docker-compose.yml`.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|||||||
Reference in New Issue
Block a user